=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2013-08-08 17:05:40 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2013-08-20 04:58:55 +0000 @@ -37,6 +37,7 @@ import org.hisp.dhis.common.IdentifiableObject; import org.hisp.dhis.document.Document; import org.hisp.dhis.mapping.Map; +import org.hisp.dhis.patientreport.PatientTabularReport; import org.hisp.dhis.report.Report; import org.hisp.dhis.reporttable.ReportTable; import org.hisp.dhis.user.User; @@ -63,6 +64,7 @@ public static final String TYPE_REPORT_TABLES = "reportTables"; public static final String TYPE_REPORTS = "reports"; public static final String TYPE_RESOURCES = "resources"; + public static final String TYPE_PATIENT_TABULAR_REPORT = "patientTabularReports"; private Chart chart; @@ -77,6 +79,8 @@ private List reports = new ArrayList(); private List resources = new ArrayList(); + + private List patientTabularReports = new ArrayList(); // ------------------------------------------------------------------------- // Constructors @@ -128,7 +132,10 @@ { return TYPE_RESOURCES; } - + else if ( !patientTabularReports.isEmpty() ) + { + return TYPE_PATIENT_TABULAR_REPORT; + } return null; } @@ -282,11 +289,26 @@ { this.resources = resources; } + + @JsonProperty( value = "patientTabularReports" ) + @JsonSerialize( contentAs = BaseIdentifiableObject.class ) + @JacksonXmlElementWrapper( localName = "patientTabularReports", namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlProperty( localName = "patientTabularReport", namespace = DxfNamespaces.DXF_2_0) + public List getPatientTabularReports() + { + return patientTabularReports; + } + + public void setPatientTabularReports( List patientTabularReports ) + { + this.patientTabularReports = patientTabularReports; + } // ------------------------------------------------------------------------- // Merge with // ------------------------------------------------------------------------- + @Override public void mergeWith( IdentifiableObject other ) { === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardSearchResult.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardSearchResult.java 2013-07-22 15:17:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardSearchResult.java 2013-08-20 04:58:55 +0000 @@ -35,6 +35,7 @@ import org.hisp.dhis.common.DxfNamespaces; import org.hisp.dhis.document.Document; import org.hisp.dhis.mapping.Map; +import org.hisp.dhis.patientreport.PatientTabularReport; import org.hisp.dhis.report.Report; import org.hisp.dhis.reporttable.ReportTable; import org.hisp.dhis.user.User; @@ -59,6 +60,8 @@ private List reports = new ArrayList(); private List resources = new ArrayList(); + + private List patientTabularReports = new ArrayList(); // ------------------------------------------------------------------------- // Constructor @@ -82,6 +85,7 @@ results += reportTables.size(); results += reports.size(); results += resources.size(); + results += patientTabularReports.size(); return results; } @@ -119,8 +123,15 @@ public int getResourceCount() { return resources.size(); + } + + @JsonProperty + public int getPatientTabularReportCount() + { + return patientTabularReports.size(); } + // ------------------------------------------------------------------------- // Getters and setters // ------------------------------------------------------------------------- @@ -208,4 +219,18 @@ { this.resources = resources; } + + @JsonProperty( value = "patientTabularReports" ) + @JsonSerialize( contentAs = BaseIdentifiableObject.class ) + @JacksonXmlElementWrapper( localName = "patientTabularReports", namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlProperty( localName = "patientTabularReports", namespace = DxfNamespaces.DXF_2_0) + public List getPatientTabularReports() + { + return patientTabularReports; + } + + public void setPatientTabularReports( List patientTabularReports ) + { + this.patientTabularReports = patientTabularReports; + } } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java 2013-05-30 09:08:10 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java 2013-08-20 04:58:55 +0000 @@ -33,14 +33,26 @@ import java.util.Set; import org.hisp.dhis.common.BaseIdentifiableObject; +import org.hisp.dhis.common.DxfNamespaces; +import org.hisp.dhis.common.view.DetailedView; +import org.hisp.dhis.common.view.ExportView; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.program.ProgramStage; import org.hisp.dhis.user.User; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonView; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + /** * @author Chau Thu Tran * @version $PatientTabularReport.java May 7, 2012 12:41:41 PM$ */ + +@JacksonXmlRootElement( localName = "patientTabularReport", namespace = DxfNamespaces.DXF_2_0 ) public class PatientTabularReport extends BaseIdentifiableObject { @@ -108,12 +120,23 @@ // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- - + + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Date getStartDate() { return startDate; } + public void setStartDate( Date startDate ) + { + this.startDate = startDate; + } + + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getUseFormNameDataElement() { return useFormNameDataElement; @@ -124,11 +147,9 @@ this.useFormNameDataElement = useFormNameDataElement; } - public void setStartDate( Date startDate ) - { - this.startDate = startDate; - } - + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Date getEndDate() { return endDate; @@ -139,6 +160,11 @@ this.endDate = endDate; } + @JsonProperty( value = "organisationUnits" ) + @JsonSerialize( contentAs = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlElementWrapper( localName = "organisationUnits", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0 ) public Set getOrganisationUnits() { return organisationUnits; @@ -149,6 +175,10 @@ this.organisationUnits = organisationUnits; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlElementWrapper( localName = "filterValues", namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlProperty( localName = "filterValue", namespace = DxfNamespaces.DXF_2_0) public List getFilterValues() { return filterValues; @@ -159,6 +189,9 @@ this.filterValues = filterValues; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public int getLevel() { return level; @@ -169,6 +202,9 @@ this.level = level; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public boolean isSortedOrgunitAsc() { return sortedOrgunitAsc; @@ -179,6 +215,9 @@ this.sortedOrgunitAsc = sortedOrgunitAsc; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getFacilityLB() { return facilityLB; @@ -189,6 +228,9 @@ this.facilityLB = facilityLB; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getUserOrganisationUnit() { return userOrganisationUnit; @@ -199,6 +241,9 @@ this.userOrganisationUnit = userOrganisationUnit; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getUserOrganisationUnitChildren() { return userOrganisationUnitChildren; @@ -209,6 +254,9 @@ this.userOrganisationUnitChildren = userOrganisationUnitChildren; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getUseCompletedEvents() { return useCompletedEvents; @@ -219,6 +267,10 @@ this.useCompletedEvents = useCompletedEvents; } + @JsonProperty + @JsonView({ DetailedView.class, ExportView.class }) + @JacksonXmlElementWrapper(localName = "users", namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlProperty(localName = "user", namespace = DxfNamespaces.DXF_2_0) public User getUser() { return user; @@ -229,6 +281,10 @@ this.user = user; } + @JsonProperty + @JsonView({ DetailedView.class, ExportView.class }) + @JacksonXmlElementWrapper(localName = "programStages", namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlProperty(localName = "programStage", namespace = DxfNamespaces.DXF_2_0) public ProgramStage getProgramStage() { return programStage; @@ -239,6 +295,9 @@ this.programStage = programStage; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getDisplayOrgunitCode() { return displayOrgunitCode; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportService.java 2013-08-19 03:45:04 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportService.java 2013-08-20 04:58:55 +0000 @@ -43,6 +43,8 @@ PatientTabularReport getPatientTabularReport( int id ); PatientTabularReport getPatientTabularReport( String name ); + + PatientTabularReport getPatientTabularReportByUid( String uid ); void deletePatientTabularReport( PatientTabularReport patientTabularReport ); === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport/DefaultPatientTabularReportService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport/DefaultPatientTabularReportService.java 2013-08-19 03:45:04 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport/DefaultPatientTabularReportService.java 2013-08-20 04:58:55 +0000 @@ -81,6 +81,12 @@ } @Override + public PatientTabularReport getPatientTabularReportByUid( String uid ) + { + return tabularReportStore.getByUid( uid ); + } + + @Override public Collection getPatientTabularReports( User user, String query, Integer min, Integer max ) { return tabularReportStore.get( user, query, min, max ); === modified file 'dhis-2/dhis-services/dhis-service-reporting/pom.xml' --- dhis-2/dhis-services/dhis-service-reporting/pom.xml 2013-07-16 14:06:13 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/pom.xml 2013-08-20 04:58:55 +0000 @@ -37,7 +37,11 @@ org.hisp.dhis dhis-service-administration - + + org.hisp.dhis + dhis-service-patient + + === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2013-08-08 17:05:40 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2013-08-20 04:58:55 +0000 @@ -35,6 +35,7 @@ import static org.hisp.dhis.dashboard.DashboardItem.TYPE_REPORT_TABLES; import static org.hisp.dhis.dashboard.DashboardItem.TYPE_RESOURCES; import static org.hisp.dhis.dashboard.DashboardItem.TYPE_USERS; +import static org.hisp.dhis.dashboard.DashboardItem.TYPE_PATIENT_TABULAR_REPORT; import java.util.List; @@ -47,6 +48,7 @@ import org.hisp.dhis.dashboard.DashboardService; import org.hisp.dhis.document.Document; import org.hisp.dhis.mapping.Map; +import org.hisp.dhis.patientreport.PatientTabularReport; import org.hisp.dhis.report.Report; import org.hisp.dhis.reporttable.ReportTable; import org.hisp.dhis.user.User; @@ -93,6 +95,7 @@ result.setReportTables( objectManager.getBetweenByName( ReportTable.class, query, 0, MAX_PER_OBJECT ) ); result.setReports( objectManager.getBetweenByName( Report.class, query, 0, MAX_PER_OBJECT ) ); result.setResources( objectManager.getBetweenByName( Document.class, query, 0, MAX_PER_OBJECT ) ); + result.setPatientTabularReports( objectManager.getBetweenByName( PatientTabularReport.class, query, 0, MAX_PER_OBJECT ) ); return result; } @@ -142,7 +145,10 @@ { item.getResources().add( objectManager.get( Document.class, contentUid ) ); } - + else if ( TYPE_PATIENT_TABULAR_REPORT.equals( type ) ) + { + item.getPatientTabularReports().add( objectManager.get( PatientTabularReport.class, contentUid ) ); + } if ( availableItem == null ) { dashboard.getItems().add( 0, item ); === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml' --- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml 2013-08-08 17:05:40 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml 2013-08-20 04:58:55 +0000 @@ -38,11 +38,11 @@ - - - + + + - + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java 2013-05-19 08:24:25 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java 2013-08-20 04:58:55 +0000 @@ -86,9 +86,9 @@ // Input // ------------------------------------------------------------------------- - private Integer id; + private String id; - public void setId( Integer id ) + public void setId( String id ) { this.id = id; } @@ -171,7 +171,7 @@ public String execute() throws Exception { - tabularReport = tabularReportService.getPatientTabularReport( id ); + tabularReport = tabularReportService.getPatientTabularReportByUid( id ); programStage = tabularReport.getProgramStage(); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/TabularInitializeAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/TabularInitializeAction.java 2013-02-19 06:54:22 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/TabularInitializeAction.java 2013-08-20 04:58:55 +0000 @@ -79,6 +79,18 @@ // Output // ------------------------------------------------------------------------- + private String id; + + public String getId() + { + return id; + } + + public void setId( String id ) + { + this.id = id; + } + private Collection programs; public Collection getPrograms() @@ -110,12 +122,12 @@ orgunitGroups = new ArrayList( organisationUnitGroupService.getAllOrganisationUnitGroups() ); Collections.sort( orgunitGroups, IdentifiableObjectNameComparator.INSTANCE ); - + programs = programService.getAllPrograms(); - programs.retainAll( programService.getProgramsByCurrentUser()); - + programs.retainAll( programService.getProgramsByCurrentUser() ); + levels = organisationUnitService.getOrganisationUnitLevels(); - + return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-08-19 06:54:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-08-20 04:58:55 +0000 @@ -32,6 +32,9 @@ obj.system.accessPatientAttributes = r.user.accessPatientAttributes; + obj.report={}; + obj.report.id = r.id; + return obj; } } @@ -201,6 +204,36 @@ a[i] = TR.conf.util.jsonEncodeString(a[i]); } return a; + }, + getURLParameters: function(paramName) { + var sURL = window.document.URL.toString(); + if (sURL.indexOf("?") > 0) + { + var arrParams = sURL.split("?"); + var arrURLParams = arrParams[1].split("&"); + var arrParamNames = new Array(arrURLParams.length); + var arrParamValues = new Array(arrURLParams.length); + var i = 0; + for (i=0;i${i18n_view}" + "${i18n_share}" + "
" + + "", + + patientTabularReport: "
  • " + + "
  • " + + "
    " + "
  • " }; @@ -344,6 +351,10 @@ { dhis2.db.renderLinkItem( $d, item.id, item.resources, "Resources", position, "../api/documents/", "/data" ); } + else if ( "patientTabularReports" == item.type ) + { + dhis2.db.renderLinkItem( $d, item.id, item.patientTabularReports, "Person tabular reports", position, "../dhis-web-caseentry/app/index.html?type=patientTabularReport&id=", "" ); + } } ); dhis2.db.renderLastDropItem( $d, parseInt( data.items.length - 1 ) ); @@ -558,6 +569,17 @@ $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "link": "../api/documents/" + o.id, "img": "document_small", "name": o.name, "type": "resources", "id": o.id } ) ); } } + + if ( data.patientTabularReportCount > 0 ) + { + $h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Tabular reports" } ) ); + + for ( var i in data.patientTabularReports ) + { + var o = data.patientTabularReports[i]; + $h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "link": "../dhis-web-caseentry/generateTabularReport.action?uid=" + o.id, "img": "document_small", "name": o.name, "type": "patientTabularReports", "id": o.id} ) ); + } + } } else {