Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC 2018 Patient Clinical Summary Enhancement Changes For reveiew #38

Open
wants to merge 52 commits into
base: master
from
Open
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
57e6f86
added first changes
dilekamadushan Jun 16, 2018
f77149f
commented changes in liquibase.xml
dilekamadushan Jun 17, 2018
7a5e7da
completed ui designs
dilekamadushan Jun 20, 2018
7b9fbf0
added controllers to get access database
dilekamadushan Jun 20, 2018
c975a99
Merge branch 'master' of https://github.com/muzima/openmrs-module-muz…
dilekamadushan Jun 20, 2018
6219746
added debug lines
dilekamadushan Jun 21, 2018
3cce4da
added liquibase changes
dilekamadushan Jun 21, 2018
a5a4d98
Merge branch 'master' into gsoc_task1
dilekamadushan Jun 21, 2018
f7f02ad
added values to database
dilekamadushan Jun 21, 2018
2015716
added insert of report functionality
dilekamadushan Jun 22, 2018
54e0271
added search functionality
dilekamadushan Jun 23, 2018
c5bf58a
added getReports method in controller
dilekamadushan Jun 24, 2018
94c7d5d
added reporting dependency
dilekamadushan Jun 26, 2018
daedd78
Merge branch 'master' of https://github.com/muzima/openmrs-module-muz…
dilekamadushan Jun 26, 2018
f8c7e2a
added dependency to poms
dilekamadushan Jun 27, 2018
eb5e00c
added dependency to poms
dilekamadushan Jun 27, 2018
cbf8811
changed mvn version
dilekamadushan Jun 28, 2018
4ecdd2c
changed mvn version
dilekamadushan Jun 28, 2018
1f2668c
added reporting version
dilekamadushan Jun 28, 2018
86f07c9
started creating ReportGeneration task
dilekamadushan Jun 29, 2018
861f43d
added method to bring reportDefinitions
dilekamadushan Jun 29, 2018
73a0d94
added method to generate reports
dilekamadushan Jul 1, 2018
593890f
get names of reports and cohorts
dilekamadushan Jul 1, 2018
8ad905b
Merge branch 'masterUpstream' into gsoc_task
dilekamadushan Jul 1, 2018
05ec7f6
improved report generation task
dilekamadushan Jul 1, 2018
1c86e88
improved editing of report configurations
dilekamadushan Jul 2, 2018
31c750b
added endpoint to download generated reports
dilekamadushan Jul 3, 2018
a17fb56
modified code
dilekamadushan Jul 3, 2018
e7ea8eb
added functionality to listen to report log
dilekamadushan Jul 10, 2018
4f9a5b4
modified logic in report generation process
dilekamadushan Jul 11, 2018
33b8bd5
added a try catch when getting reportService
dilekamadushan Jul 12, 2018
1454af8
improved task
dilekamadushan Jul 13, 2018
5b3a8f5
added checkbox
dilekamadushan Jul 18, 2018
a8cbf25
commit for muzima scrum
dilekamadushan Jul 20, 2018
5eb742f
removed comment
dilekamadushan Jul 20, 2018
d76e99e
added new method to get generatedReport by patientUuid
dilekamadushan Jul 21, 2018
c4e4fb4
added priority column to generated report table
dilekamadushan Jul 22, 2018
7e5ac5e
liquidbase change
dilekamadushan Jul 22, 2018
00cdcf8
Merge branch 'masterUpstream' into gsoc_task
dilekamadushan Jul 22, 2018
7033fe3
added Generated report resource
dilekamadushan Jul 23, 2018
0df87f3
modified logging
dilekamadushan Jul 27, 2018
150073a
bug in omod
dilekamadushan Jul 28, 2018
e560222
changed reportJson field to blob
dilekamadushan Jul 29, 2018
ae94559
modified for debug
dilekamadushan Jul 31, 2018
e845024
renamed endpoint
dilekamadushan Aug 3, 2018
3134eda
renamed endpoint param
dilekamadushan Aug 7, 2018
d7f977d
tried to remove code
dilekamadushan Aug 7, 2018
f9d6d3c
removed debug lines
dilekamadushan Aug 7, 2018
d32bb05
added comments for functions
dilekamadushan Aug 10, 2018
052e78b
Merge branch 'masterUpstream' into for_reveiew
dilekamadushan Aug 10, 2018
10fd8f0
renamed methods
dilekamadushan Aug 10, 2018
d6e827d
added comments to the task
dilekamadushan Aug 10, 2018
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+2,333 −17
Diff settings

Always

Just for now

Copy path View file
@@ -128,6 +128,12 @@
<version>3.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>reporting-api</artifactId>
<version>1.16.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<!-- end spring boot test dependencies -->
@@ -148,4 +154,4 @@
</testResources>
</build>

</project>
</project>
@@ -0,0 +1,53 @@
/**
* The contents of this file are subject to the OpenMRS Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://license.openmrs.org
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
package org.openmrs.module.muzima.api.db;

import org.openmrs.module.muzima.model.MuzimaGeneratedReport;

import java.util.List;

public interface MuzimaGeneratedReportDao {

List<MuzimaGeneratedReport> getAll();

List<MuzimaGeneratedReport> getPagedMuzimaGeneratedReports(final Integer patientId, final Integer pageNumber,
final Integer pageSize);

/**
* Get the total number of data source with matching search term.
*
*
* @param patientId the search term.
* @return total number of reports in the database.
*/
Number countMuzimaGeneratedReports(final Integer patientId);

Number countMuzimaGeneratedReports();

MuzimaGeneratedReport getMuzimaGeneratedReportById(Integer id);

MuzimaGeneratedReport getLastPriorityMuzimaGeneratedReportByPatientId(Integer id);

List<MuzimaGeneratedReport> getMuzimaGeneratedReportByPatientId(Integer id);

MuzimaGeneratedReport getMuzimaGeneratedReportByUuid(String Uuid);

MuzimaGeneratedReport getLastMuzimaGeneratedReportByPatientIdANDCohortReportConfigId(Integer patientId, Integer cohortReportConfigId);

List<MuzimaGeneratedReport> getMuzimaGeneratedReportByCohortReportConfigId(Integer cohortReportConfigId);

MuzimaGeneratedReport saveOrUpdateMuzimaGeneratedReport(MuzimaGeneratedReport muzimaGeneratedReport);

void deleteMuzimaGeneratedReport(MuzimaGeneratedReport muzimaGeneratedReport);
}
@@ -0,0 +1,46 @@
/**
* The contents of this file are subject to the OpenMRS Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://license.openmrs.org
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
package org.openmrs.module.muzima.api.db;

import org.openmrs.module.muzima.model.ReportConfiguration;

import java.util.List;

public interface ReportConfigurationDao {

List<ReportConfiguration> getAll();

List<ReportConfiguration> getPagedReportConfigurations(final String search, final Integer pageNumber, final Integer pageSize);

/**
* Get the total number of data source with matching search term.
*
*
* @param search the search term.
* @return total number of data source in the database.
*/
Number countReportConfigurations(final String search);

Number countReportConfigurations();

ReportConfiguration getReportConfigurationById(Integer id);

ReportConfiguration getReportConfigurationByUuid(String Uuid);

ReportConfiguration getReportConfigurationByReportUuid(String reportUuid);

ReportConfiguration saveOrUpdateReportConfiguration(ReportConfiguration reportConfiguration);

void deleteReportConfiguration(ReportConfiguration reportConfiguration);
}
@@ -0,0 +1,182 @@
/**
* The contents of this file are subject to the OpenMRS Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://license.openmrs.org
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
package org.openmrs.module.muzima.api.db.hibernate;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Criteria;
import org.hibernate.criterion.Disjunction;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.openmrs.api.db.hibernate.DbSession;
import org.openmrs.api.db.hibernate.DbSessionFactory;
import org.openmrs.module.muzima.api.db.MuzimaGeneratedReportDao;
import org.openmrs.module.muzima.model.MuzimaGeneratedReport;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public class HibernateMuzimaGeneratedReportDao implements MuzimaGeneratedReportDao {
private DbSessionFactory sessionFactory;
protected Class mappedClass = MuzimaGeneratedReport.class;
private final Log log = LogFactory.getLog(this.getClass());

public HibernateMuzimaGeneratedReportDao(DbSessionFactory sessionFactory){
this.sessionFactory = sessionFactory;
}

@Override
@Transactional
public List<MuzimaGeneratedReport> getAll() {
Criteria criteria = session().createCriteria(MuzimaGeneratedReport.class);
criteria.add(Restrictions.eq("retired", false));
return criteria.list();
}

/**
* Get generatedReports with matching search term for particular page.
*
* @param patientId the search term.
* @param pageNumber the page number.
* @param pageSize the size of the page.
* @return list of generatedReports for the page.
*/
@Override
@SuppressWarnings("unchecked")
public List<MuzimaGeneratedReport> getPagedMuzimaGeneratedReports(final Integer patientId, final Integer pageNumber, final Integer pageSize) {
Criteria criteria = session().createCriteria(mappedClass);
Disjunction disjunction = Restrictions.disjunction();
disjunction.add(Restrictions.eq("patientId", patientId));
criteria.add(disjunction);

criteria.add(Restrictions.eq("retired", Boolean.FALSE));
if (pageNumber != null) {
criteria.setFirstResult((pageNumber - 1) * pageSize);
}
if (pageSize != null) {
criteria.setMaxResults(pageSize);
}
criteria.addOrder(Order.desc("dateCreated"));
return criteria.list();
}

/**
* Get the total number of settings with matching search term.
*
*
* @param patientId the search term.
* @return total number of settings in the database.
*/
@Override
@Transactional
public Number countMuzimaGeneratedReports(final Integer patientId) {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(mappedClass);

Disjunction disjunction = Restrictions.disjunction();
disjunction.add(Restrictions.eq("patientId", patientId));
criteria.add(disjunction);

criteria.add(Restrictions.eq("retired", Boolean.FALSE));
criteria.setProjection(Projections.rowCount());
return (Number) criteria.uniqueResult();

}

@Override
@Transactional
public Number countMuzimaGeneratedReports(){
Criteria criteria = session().createCriteria(mappedClass);
criteria.add(Restrictions.eq("retired", Boolean.FALSE));
criteria.setProjection(Projections.rowCount());
return (Number) criteria.uniqueResult();
}

@Override
public MuzimaGeneratedReport getMuzimaGeneratedReportById(Integer id) {
Criteria criteria = session().createCriteria(mappedClass);
criteria.add(Restrictions.eq("id", id));
criteria.add(Restrictions.eq("retired", Boolean.FALSE));
return (MuzimaGeneratedReport) criteria.uniqueResult();
}


@Override
public MuzimaGeneratedReport getLastPriorityMuzimaGeneratedReportByPatientId(Integer patientId) {
Criteria criteria = session().createCriteria(mappedClass);
criteria.add(Restrictions.eq("patientId", patientId));
criteria.add(Restrictions.eq("retired", Boolean.FALSE));
criteria.add(Restrictions.eq("priority", Boolean.TRUE));
criteria.addOrder(Order.desc("dateCreated"));
criteria.setMaxResults(1);
return (MuzimaGeneratedReport) criteria.uniqueResult();

}

@Override
@Transactional
public List<MuzimaGeneratedReport> getMuzimaGeneratedReportByPatientId(Integer patientId){
Criteria criteria = session().createCriteria(mappedClass);
criteria.add(Restrictions.eq("patientId", patientId));
criteria.add(Restrictions.eq("retired", Boolean.FALSE));
return criteria.list();
}

@Override
@Transactional
public MuzimaGeneratedReport getMuzimaGeneratedReportByUuid(String uuid){
MuzimaGeneratedReport muzimaGeneratedReport = null;
Criteria criteria = session().createCriteria(mappedClass);
criteria.add(Restrictions.eq("uuid", uuid));
criteria.add(Restrictions.eq("retired", Boolean.FALSE));
muzimaGeneratedReport = (MuzimaGeneratedReport)criteria.uniqueResult();
return muzimaGeneratedReport;
}

@Override
@Transactional
public MuzimaGeneratedReport getLastMuzimaGeneratedReportByPatientIdANDCohortReportConfigId(Integer patientId, Integer cohortReportConfigId) {
Criteria criteria = session().createCriteria(mappedClass);
criteria.add(Restrictions.eq("cohortReportConfigId", cohortReportConfigId));
criteria.add(Restrictions.eq("patientId", patientId));
criteria.add(Restrictions.eq("retired", Boolean.FALSE));
criteria.addOrder(Order.desc("dateCreated"));
criteria.setMaxResults(1);
return (MuzimaGeneratedReport)criteria.uniqueResult();
}

@Override
public List<MuzimaGeneratedReport> getMuzimaGeneratedReportByCohortReportConfigId(Integer cohortReportConfigId) {
Criteria criteria = session().createCriteria(mappedClass);
criteria.add(Restrictions.eq("cohortReportConfigId", cohortReportConfigId));
criteria.add(Restrictions.eq("retired", Boolean.FALSE));
return criteria.list();
}

@Override
@Transactional
public MuzimaGeneratedReport saveOrUpdateMuzimaGeneratedReport(final MuzimaGeneratedReport muzimaGeneratedReport){
session().saveOrUpdate(muzimaGeneratedReport);
return muzimaGeneratedReport;
}

@Override
public void deleteMuzimaGeneratedReport(MuzimaGeneratedReport muzimaGeneratedReport){
session().delete(muzimaGeneratedReport);
}

private DbSession session() {
return sessionFactory.getCurrentSession();
}
}
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.