------------------------------------------------------------ revno: 1853 committer: Bharath <chbhara...@gmail.com> branch nick: trunk timestamp: Thu 2010-07-15 10:50:12 +0530 message: Changed Patinet to Benificiary; fixed bug in SummaryReport added: local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateDrillDownResultAction.java modified: dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationForm.vm dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 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-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml
-- lp:dhis2 https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk Your team DHIS 2 developers is subscribed to branch lp:dhis2. To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java 2010-06-20 08:20:32 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java 2010-07-15 05:20:12 +0000 @@ -205,7 +205,7 @@ { Patient patient = programInstance.getPatient(); //taking patient present in selected orgunit - if ( !patientListByOrgUnit.contains( patient ) ) + if ( !patientListByOrgUnit.contains( patient ) || programInstance.getEndDate() != null ) { continue; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2010-07-06 09:34:47 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2010-07-15 05:20:12 +0000 @@ -462,4 +462,6 @@ discharge_date_from_institution = Discharge Date >From Institution urine_test_Infection = Urine Test Infection discharge_date_from_institution = Discharge Date From Institution -case_aggregation = Case Aggregation \ No newline at end of file +case_aggregation = Beneficiary Aggregation +case_aggregation_form = Beneficiary Aggregation Form +dataset_list = Dataset List \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationForm.vm 2010-04-12 08:28:26 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationForm.vm 2010-07-15 05:20:12 +0000 @@ -4,7 +4,7 @@ var curPeriodType=""; </script> -<h1>Case Aggregation Form</h1> +<h1> $i18n.getString( "case_aggregation_form" )</h1> <hr /> <form id="caseAggregationForm" name="caseAggregationForm" action="caseAggregationResult.action" method="post" onsubmit="return formValidationsForCaseAggMapping()"> <table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0> @@ -19,7 +19,7 @@ <table> <tr> <td class="NormalB" colspan="2"> - $i18n.getString( "ds_dataset_list" ) : <br> + $i18n.getString( "dataset_list" ) : <br> <select id="selectedDataSets" name="selectedDataSets" onchange="getdSetPeriods()" > #foreach ( $dataSet in $datasets ) <option value='$dataSet.id' title='$dataSet.name'>$dataSet.name</option> === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js 2010-05-17 02:59:28 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js 2010-07-15 05:20:12 +0000 @@ -1025,6 +1025,13 @@ } } +function openChildRegistrationForm() +{ + var patientId = document.getElementById( "id" ).value; + + window.location.href = "../dhis-web-maintenance-patient/showAddRelationshipPatient.action?id="+patientId; +} + function doComplete() { var flag = false; === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2010-07-13 15:50:08 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2010-07-15 05:20:12 +0000 @@ -42,7 +42,7 @@ dhis-web-maintenance-user = Users dhis-web-maintenance-dataadmin = Data administration dhis-web-maintenance-settings = Settings -dhis-web-maintenance-patient = Patients and Programs +dhis-web-maintenance-patient = Beneficiaries and Programs dhis-web-caseentry = Name-Based Data Records dhis-web-dataentry = Data Entry dhis-web-importexport = Import-Export @@ -62,8 +62,8 @@ dhis-web-survey = Survey dhis-web-excel-reporting = Excel Reports dhis-web-mobile = Mobiles -patient_attribute_group = Patient Attribute Group -patient_attribute_group_management = Patient Attribute Group Management +patient_attribute_group = Beneficiary Attribute Group +patient_attribute_group_management = Beneficiary Attribute Group Management #-- Common --------------------------------------------------------------------# === 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 2010-07-06 09:34:47 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2010-07-15 05:20:12 +0000 @@ -275,7 +275,7 @@ patient_attribute = Beneficiary Attribute relationship_type = Relationship Type program = Program -case_aggregation_mapping = Case Aggregation Mapping +case_aggregation_mapping = Beneficiary Aggregation QueryBuilder dataelement_group_list = Dataelement Group List: dataelement_list = Dataelement List: program_list = Program List: === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties 2010-07-04 23:55:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties 2010-07-15 05:20:12 +0000 @@ -76,12 +76,12 @@ dhis-web-importexport = Import-Export dhis-web-datamart = Data Mart dhis-web-validationrule = Data Quality -dhis-web-dashboard = Charts +dhis-web-dashboard = Dashboard dhis-web-gis = GIS dhis-web-reporting = Reports dhis-web-openhealth-integration = Data analysis dhis-web-integration = NHRM integration -dhis-web-reports = Kerala Reports +dhis-web-reports = NRHM Reports dhis-web-dashboard-integration = Dashboard dhis-web-jforum-integration = Forum report_framework = Report framework === added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateDrillDownResultAction.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateDrillDownResultAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateDrillDownResultAction.java 2010-07-15 05:20:12 +0000 @@ -0,0 +1,371 @@ +package org.hisp.dhis.dashboard.ga.action.charts; + +import com.opensymphony.xwork2.Action; +import java.io.BufferedInputStream; +import jxl.write.Label; +import java.io.InputStream; +import java.io.File; +import java.io.FileInputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import jxl.Workbook; +import jxl.format.Alignment; +import jxl.format.Border; +import jxl.format.BorderLineStyle; +import jxl.format.Colour; +import jxl.format.VerticalAlignment; +import jxl.write.WritableCellFormat; +import jxl.write.WritableSheet; +import jxl.write.WritableWorkbook; +import org.amplecode.quick.StatementManager; +import org.hisp.dhis.caseaggregation.CaseAggregationMapping; +import org.hisp.dhis.caseaggregation.CaseAggregationMappingService; +import org.hisp.dhis.config.ConfigurationService; +import org.hisp.dhis.config.Configuration_IN; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; +import org.hisp.dhis.dataelement.DataElementCategoryService; +import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientAttributeService; +import org.hisp.dhis.patientattributevalue.PatientAttributeValue; +import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; +import org.hisp.dhis.patientdatavalue.PatientDataValue; +import org.hisp.dhis.period.Period; +import org.hisp.dhis.period.PeriodService; +import org.hisp.dhis.program.ProgramInstance; +import org.hisp.dhis.program.ProgramStageInstance; + +/** + * + * @author Administrator + */ +public class GenerateDrillDownResultAction + implements Action +{ + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + private StatementManager statementManager; + + public void setStatementManager( StatementManager statementManager ) + { + this.statementManager = statementManager; + } + + private OrganisationUnitService organisationUnitService; + + public OrganisationUnitService getOrganisationUnitService() + { + return organisationUnitService; + } + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + private CaseAggregationMappingService caseAggregationMappingService; + + public void setCaseAggregationMappingService( CaseAggregationMappingService caseAggregationMappingService ) + { + this.caseAggregationMappingService = caseAggregationMappingService; + } + + private ConfigurationService configurationService; + + public void setConfigurationService( ConfigurationService configurationService ) + { + this.configurationService = configurationService; + } + + private DataElementService dataElementService; + + public void setDataElementService( DataElementService dataElementService ) + { + this.dataElementService = dataElementService; + } + + private DataElementCategoryService dataElementCategoryOptionComboService; + + public void setDataElementCategoryOptionComboService( + DataElementCategoryService dataElementCategoryOptionComboService ) + { + this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService; + } + + private PeriodService periodService; + + public void setPeriodService( PeriodService periodService ) + { + this.periodService = periodService; + } + + private PatientAttributeValueService patientAttributeValueService; + + public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService ) + { + this.patientAttributeValueService = patientAttributeValueService; + } + + private PatientAttributeService patientAttributeService; + + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) + { + this.patientAttributeService = patientAttributeService; + } + + + + public String selectedValues; + + public String getSelectedValues() + { + return selectedValues; + } + + public void setSelectedValues( String selectedValues ) + { + this.selectedValues = selectedValues; + } + + private InputStream inputStream; + + public InputStream getInputStream() + { + return inputStream; + } + + private String fileName; + + public String getFileName() + { + return fileName; + } + + public String[] values; + + private String raFolderName; + + private String inputTemplatePath; + + private String outputReportPath; + + private Period startDate; + + private OrganisationUnit selectedOrgUnit; + + private DataElement de; + + private DataElementCategoryOptionCombo coc; + + private CaseAggregationMapping caseAggMapping; + + private String reportFileNameTB; + + public String execute() + throws Exception + { + + values = selectedValues.split( ":" ); + int orgunit = Integer.parseInt( values[0] ); + int periodid = Integer.parseInt( values[3] ); + int deid = Integer.parseInt( values[1] ); + int cocid = Integer.parseInt( values[2] ); + + startDate = periodService.getPeriod( periodid ); + selectedOrgUnit = organisationUnitService.getOrganisationUnit( orgunit ); + de = dataElementService.getDataElement( deid ); + coc = dataElementCategoryOptionComboService.getDataElementCategoryOptionCombo( cocid ); + System.out.println( "orgunit is " + orgunit + " de is " + deid + " coc is " + cocid + " period is " + periodid ); + + statementManager.initialise(); + raFolderName = configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue(); + + reportFileNameTB = "DrillDownToCaseBased.xls"; + // Initialization + inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "template" + + File.separator + reportFileNameTB; + + outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + + File.separator + UUID.randomUUID().toString() + ".xls"; + + System.out.println( " inputTemplatePath " + inputTemplatePath ); + + generatDrillDownReport(); + statementManager.destroy(); + return SUCCESS; + }// end if loop + + public void generatDrillDownReport() + throws Exception + { + Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) ); + + WritableWorkbook outputReportWorkbook = Workbook + .createWorkbook( new File( outputReportPath ), templateWorkbook ); + + // Cell formatting + WritableCellFormat wCellformat = new WritableCellFormat(); + wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN ); + wCellformat.setAlignment( Alignment.CENTRE ); + wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE ); + + caseAggMapping = caseAggregationMappingService.getCaseAggregationMappingByOptionCombo( de, coc ); + + List<PatientDataValue> patientDataValues = caseAggregationMappingService.getCaseAggregatePatientDataValue( + selectedOrgUnit, startDate, caseAggMapping ); + List<String> allValues = new ArrayList<String>(); + + List<ProgramInstance> pInstances = new ArrayList<ProgramInstance>(); + List<Date> executionDates = new ArrayList<Date>(); + List<DataElement> des = new ArrayList<DataElement>(); + + Map<ProgramInstance, Date> pSInstancesMap = new HashMap<ProgramInstance, Date>(); + + for ( PatientDataValue patientDataValue : patientDataValues ) + { + allValues.add( patientDataValue.getValue() ); + if ( !des.contains( patientDataValue.getDataElement() ) ) + des.add( patientDataValue.getDataElement() ); + ProgramStageInstance psi = patientDataValue.getProgramStageInstance(); + pSInstancesMap.put( psi.getProgramInstance(), psi.getExecutionDate() ); + pInstances.add( psi.getProgramInstance() ); + executionDates.add( psi.getExecutionDate() ); + System.out.println( "value = " + patientDataValue.getValue() + " psiid " + psi.getId() + + " exceution date is " + psi.getExecutionDate() ); + } + + WritableSheet sheet0 = outputReportWorkbook.getSheet( 0 ); + WritableCellFormat wCellformat1 = new WritableCellFormat(); + wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN ); + wCellformat1.setAlignment( Alignment.CENTRE ); + wCellformat1.setVerticalAlignment( VerticalAlignment.CENTRE ); + wCellformat1.setBackground( Colour.GRAY_50 ); + // adding column names + // selected orgunit + sheet0.addCell( new Label( 1, 1, "Selected orgunit", wCellformat1 ) ); + + // village + sheet0.addCell( new Label( 2, 1, "Village", wCellformat1 ) ); + + //patient Identifier + sheet0.addCell( new Label( 3, 1, "Patient Identifier", wCellformat1 ) ); + + // patient name + sheet0.addCell( new Label( 4, 1, "Patient Name", wCellformat1 ) ); + + // Address + sheet0.addCell( new Label( 5, 1, "Address", wCellformat1 ) ); + + // Sex + sheet0.addCell( new Label( 6, 1, "Gender", wCellformat1 ) ); + + // Age + sheet0.addCell( new Label( 7, 1, "Age", wCellformat1 ) ); + + + int count1 = 0; + System.out.println( "des size " + des.size() ); + for ( DataElement de : des ) + { + // DEName + sheet0.addCell( new Label( 8 + count1, 1, "" + de.getName(), wCellformat1 ) ); + + // Execution date + sheet0.addCell( new Label( 9 + count1, 1, "Execution Date", wCellformat1 ) ); + + count1++; + } + + PatientAttribute villageAttribute = patientAttributeService.getPatientAttributeByName( "Gram Panchayat or Village" ); + PatientAttribute addressAttribute = patientAttributeService.getPatientAttributeByName( "Address" ); + + int rowCount = 0; + for ( int i = 0; i < pInstances.size(); i++ ) + { + + rowCount = i; + ProgramInstance pi = pInstances.get( i ); + String value = allValues.get( i ); + Date executionDate = executionDates.get( i ); + Patient patient = pi.getPatient(); + + // selected orgunit + sheet0.addCell( new Label( 1, 2 + rowCount, selectedOrgUnit.getName(), wCellformat ) ); + + // village + PatientAttributeValue villageAttributeValue = patientAttributeValueService.getPatientAttributeValue( + patient, villageAttribute ); + if ( villageAttributeValue != null ) + { + sheet0.addCell( new Label( 2, 2 + rowCount, villageAttributeValue.getValue(), wCellformat ) ); + } + else + { + sheet0.addCell( new Label( 2, 2 + rowCount, " ", wCellformat ) ); + } + + //patinet Identifier + sheet0.addCell( new Label( 3, 2 + rowCount, patient.getIdentifiers().iterator().next().getIdentifier(), wCellformat ) ); + + // patient name + sheet0.addCell( new Label( 4, 2 + rowCount, patient.getFirstName(), wCellformat ) ); + + // Address + PatientAttributeValue addressAttributeValue = patientAttributeValueService.getPatientAttributeValue( + patient, addressAttribute ); + if ( addressAttributeValue != null ) + { + sheet0.addCell( new Label( 5, 2 + rowCount, addressAttributeValue.getValue(), wCellformat ) ); + } + else + { + sheet0.addCell( new Label( 5, 2 + rowCount, " ", wCellformat ) ); + } + + // Sex + sheet0.addCell( new Label( 6, 2 + rowCount, patient.getGender(), wCellformat ) ); + + // age + sheet0.addCell( new Label( 7, 2 + rowCount, patient.getAge(), wCellformat ) ); + + for ( int count = 0; count < des.size(); count++ ) + { + // DE Value + sheet0.addCell( new Label( 8 + count, 2 + rowCount, "" + value, wCellformat ) ); + + // Execution date + SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" ); + String eDate = simpleDateFormat.format( executionDate ); + sheet0.addCell( new Label( 9 + count, 2 + rowCount, "" + eDate, wCellformat ) ); + + count++; + } + } + + outputReportWorkbook.write(); + outputReportWorkbook.close(); + + fileName = reportFileNameTB.replace( ".xls", "" ); + // System.out.println("fileName = " + fileName); + fileName += "_" + selectedOrgUnit.getShortName() + ".xls"; + // System.out.println("fileName = " + fileName + " outputReportPath = " + // + outputReportPath); + File outputReportFile = new File( outputReportPath ); + inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) ); + + outputReportFile.deleteOnExit(); + // Cell formatting + + } +} === modified file 'local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml' --- local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml 2010-07-13 09:28:43 +0000 +++ local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml 2010-07-15 05:20:12 +0000 @@ -333,6 +333,7 @@ <!-- 09/07/2010 --> <!-- DataSet Lock Reports --> + <!-- <bean id="org.hisp.dhis.reports.datasetlock.action.GenerateDataSetLockReportAnalyserFormAction" class="org.hisp.dhis.reports.datasetlock.action.GenerateDataSetLockReportAnalyserFormAction" @@ -341,17 +342,8 @@ <property name="periodService"> <ref bean="org.hisp.dhis.period.PeriodService"/> </property> - <!-- - <property name="organisationUnitService"> - <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/> - </property> - <property name="reportService"> - <ref bean="org.hisp.dhis.reports.util.ReportService"/> - </property> - --> - </bean> - + </bean> <bean id="org.hisp.dhis.reports.datasetlock.action.GenerateDataSetLockReportResultAction" class="org.hisp.dhis.reports.datasetlock.action.GenerateDataSetLockReportResultAction" @@ -396,7 +388,7 @@ <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/> </property> </bean> - + --> <!-- --> <!-- Linelisting Reports -->
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp