dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06866
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1917: Fixed portal and benificiary report
------------------------------------------------------------
revno: 1917
committer: Namrata
branch nick: trunk
timestamp: Wed 2010-08-11 16:06:52 +0530
message:
Fixed portal and benificiary report
modified:
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java
local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForBenificiaryInfo.vm
--
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 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java 2010-08-09 05:26:05 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java 2010-08-11 10:36:52 +0000
@@ -28,6 +28,7 @@
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.VerticalAlignment;
+import jxl.format.Font;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
@@ -60,6 +61,7 @@
import com.opensymphony.xwork2.Action;
import java.util.Collections;
+import jxl.format.Colour;
import jxl.write.Label;
import jxl.write.WritableCell;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
@@ -333,6 +335,7 @@
deWCellformat.setAlignment( Alignment.CENTRE );
deWCellformat.setVerticalAlignment( VerticalAlignment.JUSTIFY );
deWCellformat.setWrap( true );
+ deWCellformat.setBackground(Colour.GREY_40_PERCENT);
// OrgUnit Related Info
selectedOrgUnit = new OrganisationUnit();
@@ -354,7 +357,7 @@
WritableSheet sheet0 = outputReportWorkbook.getSheet( 0 );
//System.out.println( "curProgram = " + curProgram.getName() );
- int count1 = 0;
+ int count1 = 0;
int rowStart = 0;
Map<String, List<Patient>> ouPatientList = new HashMap<String, List<Patient>>();
@@ -367,10 +370,11 @@
{
// <editor-fold defaultstate="collapsed" desc="saving level of ou in map and list">
int level = organisationUnitService.getLevelOfOrganisationUnit( ou );
+
ouAndLevel.put( ou, level );
if( !levelsList.contains( level ) )
{
- //System.out.println( "level "+level );
+ //System.out.println("ou "+ou.getName() + " level = "+level);
levelsList.add( level );
}
// </editor-fold>
@@ -420,6 +424,7 @@
// </editor-fold>
}
// </editor-fold>
+
// <editor-fold defaultstate="collapsed" desc="getting rowStart">
for ( String deCodeString : deCodesList )
{
@@ -431,10 +436,19 @@
count1++;
}
// </editor-fold>
+ int lastColNo = colList.get(colList.size()-1);
+ // <editor-fold defaultstate="collapsed" desc="adding oulevelname in report as column name">
+ for( int i=levelsList.size()-1;i>=0;i-- )
+ {
+ int level = levelsList.get(i);
+ lastColNo++;
+ sheet0.addCell( new Label(lastColNo , rowStart-1, organisationUnitService.getOrganisationUnitLevelByLevel(level).getName(), deWCellformat ) );
+ }
+ // </editor-fold>
+
// <editor-fold defaultstate="collapsed" desc="for loop for ouList">
for ( OrganisationUnit ou : ouList )
{
-
List<Patient> patientsList = ouPatientList.get( ou.getName() );
// <editor-fold defaultstate="collapsed" desc="for loop for patientsList">
for ( Patient patient : patientsList )
@@ -545,6 +559,8 @@
count1++;
}//end of decodelist for loop
// </editor-fold>
+
+
// <editor-fold defaultstate="collapsed" desc="adding ou in report at the end column">
OrganisationUnit ouname = ou;
for( int i=levelsList.size()-1;i>=0;i-- )
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java 2010-08-07 08:08:54 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java 2010-08-11 10:36:52 +0000
@@ -400,7 +400,7 @@
//Collection<PatientIdentifier> patientIdentifiers = patientIdentifierService.getPatientIdentifiersByOrgUnit( selectedOrgUnit );
- Collection<Patient> patientListByOrgUnit = new ArrayList<Patient>();
+
//patientListByOrgUnit.addAll( patientService.getPatientsByOrgUnit( selectedOrgUnit ) );
// Getting Programs
@@ -416,6 +416,7 @@
for ( int pn = 0; pn < programNames.length; pn++ )
{
Program curProgram = programService.getProgram( Integer.parseInt( programNames[pn] ) );
+
// <editor-fold defaultstate="collapsed" desc="if curprog!=null">
if ( curProgram != null )
{
@@ -444,32 +445,32 @@
dhisPortalMap.put( "false", "No" );
//putting linked facility / place of delivery
- dhisPortalMap.put( "( Sub Centre )", "Sub-center" );
- dhisPortalMap.put( "( PHC )", "PHC" );
- dhisPortalMap.put( "( CHC )", "CH" );
- dhisPortalMap.put( "( SDH )", "SDH" );
- dhisPortalMap.put( "( DH )", "DH" );
+ dhisPortalMap.put( "(Sub Centre)", "Sub-center" );
+ dhisPortalMap.put( "(PHC)", "PHC" );
+ dhisPortalMap.put( "(CHC)", "CH" );
+ dhisPortalMap.put( "(SDH)", "SDH" );
+ dhisPortalMap.put( "(DH)", "DH" );
//anemia
- dhisPortalMap.put( "( Normal )", "Normal" );
- dhisPortalMap.put( "( Moderate <11 )", "( Moderate<11" );
- dhisPortalMap.put( "( Severe <7 )", "Severe<7" );
+ dhisPortalMap.put( "(Normal)", "Normal" );
+ dhisPortalMap.put( "(Moderate <11)", "( Moderate<11" );
+ dhisPortalMap.put( "(Severe <7)", "Severe<7" );
//anc Complication
- dhisPortalMap.put( "( ANC None )", "None" );
- dhisPortalMap.put( "( Hypertensive )", "Hypertensive" );
- dhisPortalMap.put( "( Diabetics )", "Diabetics" );
- dhisPortalMap.put( "( APH )", "APH" );
- dhisPortalMap.put( "( Malaria )", "Malaria" );
+ dhisPortalMap.put( "(ANC None)", "None" );
+ dhisPortalMap.put( "(Hypertensive)", "Hypertensive" );
+ dhisPortalMap.put( "(Diabetics)", "Diabetics" );
+ dhisPortalMap.put( "(APH)", "APH" );
+ dhisPortalMap.put( "(Malaria)", "Malaria" );
//place of delivery home type
- dhisPortalMap.put( "( Home non SBA )", "Non SBA" );
- dhisPortalMap.put( "( Home SBA )", "SBA" );
+ dhisPortalMap.put( "(Home non SBA)", "Non SBA" );
+ dhisPortalMap.put( "(Home SBA)", "SBA" );
//place of delivery public
- dhisPortalMap.put( "( Sub Centre )", "Sub Centre" );
- dhisPortalMap.put( "( PHC. )", "PHC" );
- dhisPortalMap.put( "( CHC. )", "CH" );
- dhisPortalMap.put( "( SDH. )", "SDH" );
- dhisPortalMap.put( "( DH. )", "DH" );
+ dhisPortalMap.put( "(Sub Centre)", "Sub Centre" );
+ dhisPortalMap.put( "(PHC.)", "PHC" );
+ dhisPortalMap.put( "(CHC.)", "CH" );
+ dhisPortalMap.put( "(SDH.)", "SDH" );
+ dhisPortalMap.put( "(DH.)", "DH" );
//place of delivery private
- dhisPortalMap.put( "( Private )", "Private" );
+ dhisPortalMap.put( "(Private)", "Private" );
List<String> podHomeList = new ArrayList<String>();
podHomeList.add( "Non SBA" );
podHomeList.add( "SBA" );
@@ -485,28 +486,28 @@
podPrivateList.add( "Private" );
//delivery type
- dhisPortalMap.put( "( Normal. )", "Normal" );
- dhisPortalMap.put( "( C Section )", "CS" );
- dhisPortalMap.put( "( Instrumental )", "Instrumental" );
+ dhisPortalMap.put( "(Normal.)", "Normal" );
+ dhisPortalMap.put( "(C Section)", "CS" );
+ dhisPortalMap.put( "(Instrumental)", "Instrumental" );
//abortion
- dhisPortalMap.put( "( MTP < 12 Weeks )", "MTP<12" );
- dhisPortalMap.put( "( MTP > 12 Weeks )", "MTP>12" );
- dhisPortalMap.put( "( Spontaneous )", "Spontaneous" );//not thr in excel sheet
- dhisPortalMap.put( "( None )", "None" );
+ dhisPortalMap.put( "(MTP < 12 Weeks)", "MTP<12" );
+ dhisPortalMap.put( "(MTP > 12 Weeks)", "MTP>12" );
+ dhisPortalMap.put( "(Spontaneous)", "Spontaneous" );//not thr in excel sheet
+ dhisPortalMap.put( "(None)", "None" );
//pnc visit
- dhisPortalMap.put( "( with in 7 days )", "Within 7 days" );
- dhisPortalMap.put( "( With in 48 hrs )", "Within 48 hours" );
+ dhisPortalMap.put( "(with in 7 days)", "Within 7 days" );
+ dhisPortalMap.put( "(With in 48 hrs)", "Within 48 hours" );
//pnc complications
- dhisPortalMap.put( "( None. )", "None" );
- dhisPortalMap.put( "( Sepsis )", "Sepsis" );
- dhisPortalMap.put( "( PPH )", "PPH" );
- dhisPortalMap.put( "( Death )", "PPH" );
- dhisPortalMap.put( "( Others. )", "Others" );
+ dhisPortalMap.put( "(None.)", "None" );
+ dhisPortalMap.put( "(Sepsis)", "Sepsis" );
+ dhisPortalMap.put( "(PPH)", "PPH" );
+ dhisPortalMap.put( "(Death)", "PPH" );
+ dhisPortalMap.put( "(Others.)", "Others" );
//pp contrapception
- dhisPortalMap.put( "( Other method )", "None" );
- dhisPortalMap.put( "( Sterilisation )", "Sterilisation" );
- dhisPortalMap.put( "( IUD )", "IUD" );
- dhisPortalMap.put( "( Injectibles )", "Injectibles" );
+ dhisPortalMap.put( "(Other method)", "None" );
+ dhisPortalMap.put( "(Sterilisation)", "Sterilisation" );
+ dhisPortalMap.put( "(IUD)", "IUD" );
+ dhisPortalMap.put( "(Injectibles)", "Injectibles" );
//child health
//blood group
dhisPortalMap.put( "A+", "A+" );
@@ -537,11 +538,13 @@
Map<Patient, ProgramInstance> patientPIList = new HashMap<Patient, ProgramInstance>();
Map<ProgramInstance, Collection<ProgramStageInstance>> PIPSIList = new HashMap<ProgramInstance, Collection<ProgramStageInstance>>();
Map<ProgramInstance, Collection<ProgramStageInstance>> PIAllPSIList = new HashMap<ProgramInstance, Collection<ProgramStageInstance>>();
+ Map<Patient, OrganisationUnit> patientOuList = new HashMap<Patient, OrganisationUnit>();
orgUnitList = getChildOrgUnitTree( selectedOrgUnit );
-
+ //System.out.println("curprogram "+curProgram.getName());
// <editor-fold defaultstate="collapsed" desc="for loop for Orgunitlist">
for ( OrganisationUnit ou : orgUnitList )
{
+ Collection<Patient> patientListByOrgUnit = new ArrayList<Patient>();
patientListByOrgUnit.addAll( patientService.getPatientsByOrgUnit( ou ) );
Iterator<Patient> patientIterator = patientListByOrgUnit.iterator();
@@ -549,6 +552,7 @@
while ( patientIterator.hasNext() )
{
Patient patient = patientIterator.next();
+
//checking if patient is enrolled to curprog then adding them in one list
Collection<ProgramInstance> programInstances = new ArrayList<ProgramInstance>();
programInstances = programInstanceService.getProgramInstances( patient, curProgram );
@@ -556,6 +560,7 @@
// <editor-fold defaultstate="collapsed" desc="for loop for programInstances">
for ( ProgramInstance pi : programInstances )
{
+ //System.out.println("_________________________________patient: "+patient.getFullName() + " id = "+patient.getId() + " ou = "+ou.getName());
Collection<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
Collection<ProgramStageInstance> allProgramStageInstances = new ArrayList<ProgramStageInstance>();
Iterator itr1 = programStagesList.iterator();
@@ -576,6 +581,7 @@
if ( programStageInstance.getExecutionDate().after( sDate ) && programStageInstance.getExecutionDate().before( eDate ) )
{
programStageInstances.add( programStageInstance );
+ //System.out.println("srno: "+programStageInstances.size() + " patient: "+patient + " pi "+pi.getId() + " psi "+programStageInstance.getId());
}
}
}
@@ -590,8 +596,10 @@
//putting pi and psi together
PIPSIList.put( pi, programStageInstances );
PIAllPSIList.put( pi, allProgramStageInstances );
+ //System.out.println("allProgramStageInstances size = "+allProgramStageInstances.size()+ " programStageInstances "+programStageInstances.size() + " pi = "+pi.getId() );
//putting patient and pi together
patientPIList.put( patient, pi );
+ patientOuList.put(patient, ou);
patientList.add( patient );
}
@@ -611,7 +619,7 @@
ProgramInstance programInstance = patientPIList.get( patient );
String cAPhoneNumberName = "";
- //System.out.println( "______________________________ patient = " + patient.getFullName() + " id = " + patient.getId() );
+ //System.out.println( "==================== patient = " + patient.getFullName() + " id = " + patient.getId() + " piid = "+ patientPIList.get(patient).getId()+ " psilist size = "+ PIPSIList.get(patientPIList.get(patient)).size() );
count1 = 0;
int rowNo = rowList.get( 1 ) + rowCount;
// <editor-fold defaultstate="collapsed" desc="for loop of deCodesList">
@@ -677,7 +685,7 @@
if ( pStageInstance.getExecutionDate() != null ) {
if ( includePeriod != null ) {
if ( pStageInstance.getExecutionDate().before( eDate ) ) {
- PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, selectedOrgUnit );
+ PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, patientOuList.get(patient) );
if ( patientDataValue1 == null ) {
tempStr = " ";
@@ -710,7 +718,7 @@
}
}
} else {
- PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, selectedOrgUnit );
+ PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, patientOuList.get(patient) );
if ( patientDataValue1 == null ) {
tempStr = " ";
@@ -752,25 +760,30 @@
{
if ( deCodeString.equalsIgnoreCase( "FACILITY" ) )
{
- tempStr = selectedOrgUnit.getName();
+ tempStr = patientOuList.get(patient).getName();
}
else
{
int deCodeInt = Integer.parseInt( deCodeString );
- //_______________________all programdes_______________________
+ //System.out.println("deCode = "+deCodeString);
DataElement d1e = dataElementService.getDataElement( deCodeInt );
Collection<ProgramStageInstance> programStageInstances = PIAllPSIList.get( programInstance );
Iterator<ProgramStageInstance> itrPSI = programStageInstances.iterator();
while ( itrPSI.hasNext() )
{
ProgramStageInstance programStageInstance = itrPSI.next();
- PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, selectedOrgUnit );
+
+ PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+ //System.out.println("psi = "+programStageInstance.getId() + " de = "+d1e + " ou = "+patientOuList.get(patient));
if ( patientDataValue != null )
{
+ //System.out.println("tempStr = "+patientDataValue.getValue() + " de = "+d1e.getId());
if ( d1e.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_STRING ) && d1e.isMultiDimensional() )
{
+
DataElementCategoryOptionCombo dataElementCategoryOptionCombo = dataElementCategoryOptionComboService.getDataElementCategoryOptionCombo( Integer.parseInt( patientDataValue.getValue() ) );
tempStr = dataElementCategoryOptionCombo.getName();
+
if ( dhisPortalMap.containsKey( tempStr ) )
{
tempStr = dhisPortalMap.get( tempStr );
@@ -789,10 +802,7 @@
{
tempStr = simpleLmpDateFormat.format( doseDate );
}
- else
- {
- tempStr = "";
- }
+
}
else
{
@@ -800,10 +810,7 @@
}
}
- else
- {
- tempStr = "";
- }
+
}
else
{
@@ -815,12 +822,17 @@
}
}
+
}
else
{
continue;
}
-
+
+ }
+ if(tempStr.trim().equals(""))
+ {
+ tempStr = "";
}
}
//
@@ -908,7 +920,7 @@
while ( itrPSI.hasNext() )
{
ProgramStageInstance programStageInstance = itrPSI.next();
- PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, selectedOrgUnit );
+ PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
if ( patientDataValue != null )
{
if ( d1e.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_DATE ) )
@@ -960,7 +972,7 @@
{
ProgramStageInstance programStageInstance = itrPSI.next();
- PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstance, d1e, selectedOrgUnit );
+ PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
if ( patientDataValue1 != null )
{
ifaCount = Integer.parseInt( patientDataValue1.getValue() ) + ifaCount;
@@ -979,12 +991,15 @@
int deCodeInt = Integer.parseInt( deCodeString );
PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( deCodeInt );
PatientAttributeValue patientAttributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute );
+ //System.out.println("patient "+patient +" pattr = "+patientAttribute.getName());
+
String name = "";
if ( patientAttributeValue != null )
{
if ( sType.equalsIgnoreCase( "caseAttributePN" ) )
{
name = patientAttributeValue.getValue();
+ System.out.println("name = "+name);
if ( curProgram.getId() == 1 && dhisPortalMap.containsKey( name ) )
{
cAPhoneNumberName = name;
=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForBenificiaryInfo.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForBenificiaryInfo.vm 2010-08-06 09:50:49 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForBenificiaryInfo.vm 2010-08-11 10:36:52 +0000
@@ -3,7 +3,7 @@
<li>Report Analysis</li>
<ul>
<li>
- NBITS Reports
+ NBITS Benificiary Info
</li>
</ul>
</ul>