dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11897
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3505: Minor fixes in patient module
------------------------------------------------------------
revno: 3505
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-05-02 20:40:36 +0200
message:
Minor fixes in patient module
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAndProgramMenu.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 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java 2010-11-29 02:04:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java 2011-05-02 18:40:36 +0000
@@ -183,9 +183,9 @@
public Collection<PatientDataValue> get( Patient patient, Collection<DataElement> dataElements, Date startDate,
Date endDate )
{
- String hql = "From PatientDataValue pdv where pdv.dataElement in ( :dataElements ) "
- + "AND pdv.programStageInstance.programInstance.patient = :patient "
- + "AND pdv.programStageInstance.executionDate >= :startDate AND pdv.programStageInstance.executionDate <= :endDate ";
+ String hql = "from PatientDataValue pdv where pdv.dataElement in ( :dataElements ) "
+ + "and pdv.programStageInstance.programInstance.patient = :patient "
+ + "and pdv.programStageInstance.executionDate >= :startDate and pdv.programStageInstance.executionDate <= :endDate ";
return getQuery( hql ).setParameterList( "dataElements", dataElements ).setEntity( "patient", patient )
.setDate( "startDate", startDate ).setDate( "endDate", endDate ).list();
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2011-04-28 07:10:33 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2011-05-02 18:40:36 +0000
@@ -97,20 +97,36 @@
String hql = "from ProgramStageInstance where programInstance.patient.organisationUnit = :unit";
if ( after != null )
+ {
hql += " and dueDate >= :after";
+ }
+
if ( before != null )
+ {
hql += " and dueDate <= :before";
+ }
+
if ( completed != null )
+ {
hql += " and completed = :completed";
+ }
Query q = getQuery( hql ).setEntity( "unit", unit );
if ( after != null )
+ {
q.setDate( "after", after );
+ }
+
if ( before != null )
+ {
q.setDate( "before", before );
+ }
+
if ( completed != null )
+ {
q.setBoolean( "completed", completed );
+ }
return q.list();
}
@@ -119,10 +135,7 @@
public List<ProgramStageInstance> getProgramStageInstances( Patient patient, Boolean completed )
{
String hql = "from ProgramStageInstance where programInstance.patient = :patient and completed = :completed";
- Query q = getQuery( hql );
- q.setEntity( "patient", patient );
- q.setBoolean( "completed", completed );
- return q.list();
+
+ return getQuery( hql ).setEntity( "patient", patient ).setBoolean( "completed", completed ).list();
}
-
}
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2011-04-07 08:21:36 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2011-05-02 18:40:36 +0000
@@ -266,8 +266,8 @@
"AND d.lastupdated<a.lastupdated";
}
- public String deleteOldestOverlappingArchiveData()
- {
+ public String deleteOldestOverlappingArchiveData()
+ {
return "DELETE a FROM datavaluearchive AS a " +
"INNER JOIN datavalue AS d " +
"WHERE a.dataelementid=d.dataelementid " +
@@ -275,104 +275,106 @@
"AND a.sourceid=d.sourceid " +
"AND a.categoryoptioncomboid=d.categoryoptioncomboid " +
"AND a.lastupdated<=d.lastupdated";
- }
+ }
- public String archivePatientData ( String startDate, String endDate )
- {
- return "DELETE pdv FROM patientdatavalue AS pdv "
- + "INNER JOIN programstageinstance AS psi "
- + "ON pdv.programstageinstanceid = psi.programstageinstanceid "
- + "INNER JOIN programinstance AS pi "
- + "ON pi.programinstanceid = psi.programinstanceid "
- + "WHERE pi.enddate >= '" + startDate + "' "
- + "AND pi.enddate <= '" + endDate + "';";
- }
-
- public String unArchivePatientData ( String startDate, String endDate )
- {
- return "DELETE pdv FROM patientdatavaluearchive AS pdv "
- + "INNER JOIN programstageinstance AS psi "
- + "ON pdv.programstageinstanceid = psi.programstageinstanceid "
- + "INNER JOIN programinstance AS pi "
- + "ON pi.programinstanceid = psi.programinstanceid "
- + "WHERE pi.enddate >= '" + startDate + "' "
- + "AND pi.enddate <= '" + endDate + "';";
- }
-
- public String deleteRegularOverlappingPatientData(){
- return "DELETE d FROM patientdatavalue AS d " +
- "INNER JOIN patientdatavaluearchive AS a " +
- "WHERE d.programstageinstanceid=a.programstageinstanceid " +
- "AND d.dataelementid=a.dataelementid " +
- "AND d.organisationunitid=a.organisationunitid " +
- "AND d.categoryoptioncomboid=a.categoryoptioncomboid;";
- }
-
- public String deleteArchivedOverlappingPatientData()
- {
- return "DELETE a FROM patientdatavaluearchive AS a " +
- "INNER JOIN patientdatavalue AS d " +
- "WHERE d.programstageinstanceid=a.programstageinstanceid " +
- "AND d.dataelementid=a.dataelementid " +
- "AND d.organisationunitid=a.organisationunitid " +
- "AND d.categoryoptioncomboid=a.categoryoptioncomboid ";
- }
-
- public String deleteOldestOverlappingPatientDataValue(){
- return "DELETE d FROM patientdatavalue AS d " +
- "INNER JOIN patientdatavaluearchive AS a " +
- "WHERE d.programstageinstanceid=a.programstageinstanceid " +
- "AND d.dataelementid=a.dataelementid " +
- "AND d.organisationunitid=a.organisationunitid " +
- "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
- "AND d.timestamp<a.timestamp;";
- }
-
- public String deleteOldestOverlappingPatientArchiveData(){
- return "DELETE a FROM patientdatavaluearchive AS a " +
- "INNER JOIN patientdatavalue AS d " +
- "WHERE d.programstageinstanceid=a.programstageinstanceid " +
- "AND d.dataelementid=a.dataelementid " +
- "AND d.organisationunitid=a.organisationunitid " +
- "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
- "AND a.timestamp<=d.timestamp;";
- }
-
- public String getPatientsByFullName( String fullName )
- {
- return "SELECT patientid FROM patient " +
- "where lower(concat( firstname, \" \",middleName , \" \" , lastname) ) " +
- "like lower('%" + fullName + "%') ";
- }
-
- public String getPatientsByFullName( String fullName, int min, int max )
- {
- return "SELECT patientid FROM patient " +
- "where lower(concat( firstname, \" \",middleName , \" \" , lastname) ) " +
- "like lower('%" + fullName + "%') " +
- "limit " + min + " ," + max;
- }
-
- public String countPatientsByFullName( String fullName )
- {
- return "SELECT count(patientid) FROM patient " +
- "where lower(concat( firstname, \" \",middleName , \" \" , lastname) ) " +
- "like lower('%" + fullName + "%')";
- }
-
- public String queryDataElementStructureForOrgUnit()
- {
- StringBuffer sqlsb = new StringBuffer();
- sqlsb.append( "(SELECT DISTINCT de.dataelementid, concat(de.name, \" \", cc.categoryoptioncomboname) AS DataElement " );
- sqlsb.append( "FROM dataelement AS de " );
- sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
- sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
- sqlsb.append( "ORDER BY DataElement) " );
- return sqlsb.toString();
-
- }
-
- public String queryRawDataElementsForOrgUnitBetweenPeriods(Integer orgUnitId, List<Integer> betweenPeriodIds)
+ public String archivePatientData ( String startDate, String endDate )
+ {
+ return "DELETE pdv FROM patientdatavalue AS pdv "
+ + "INNER JOIN programstageinstance AS psi "
+ + "ON pdv.programstageinstanceid = psi.programstageinstanceid "
+ + "INNER JOIN programinstance AS pi "
+ + "ON pi.programinstanceid = psi.programinstanceid "
+ + "WHERE pi.enddate >= '" + startDate + "' "
+ + "AND pi.enddate <= '" + endDate + "';";
+ }
+
+ public String unArchivePatientData ( String startDate, String endDate )
+ {
+ return "DELETE pdv FROM patientdatavaluearchive AS pdv "
+ + "INNER JOIN programstageinstance AS psi "
+ + "ON pdv.programstageinstanceid = psi.programstageinstanceid "
+ + "INNER JOIN programinstance AS pi "
+ + "ON pi.programinstanceid = psi.programinstanceid "
+ + "WHERE pi.enddate >= '" + startDate + "' "
+ + "AND pi.enddate <= '" + endDate + "';";
+ }
+
+ public String deleteRegularOverlappingPatientData()
+ {
+ return "DELETE d FROM patientdatavalue AS d " +
+ "INNER JOIN patientdatavaluearchive AS a " +
+ "WHERE d.programstageinstanceid=a.programstageinstanceid " +
+ "AND d.dataelementid=a.dataelementid " +
+ "AND d.organisationunitid=a.organisationunitid " +
+ "AND d.categoryoptioncomboid=a.categoryoptioncomboid;";
+ }
+
+ public String deleteArchivedOverlappingPatientData()
+ {
+ return "DELETE a FROM patientdatavaluearchive AS a " +
+ "INNER JOIN patientdatavalue AS d " +
+ "WHERE d.programstageinstanceid=a.programstageinstanceid " +
+ "AND d.dataelementid=a.dataelementid " +
+ "AND d.organisationunitid=a.organisationunitid " +
+ "AND d.categoryoptioncomboid=a.categoryoptioncomboid ";
+ }
+
+ public String deleteOldestOverlappingPatientDataValue()
+ {
+ return "DELETE d FROM patientdatavalue AS d " +
+ "INNER JOIN patientdatavaluearchive AS a " +
+ "WHERE d.programstageinstanceid=a.programstageinstanceid " +
+ "AND d.dataelementid=a.dataelementid " +
+ "AND d.organisationunitid=a.organisationunitid " +
+ "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
+ "AND d.timestamp<a.timestamp;";
+ }
+
+ public String deleteOldestOverlappingPatientArchiveData()
+ {
+ return "DELETE a FROM patientdatavaluearchive AS a " +
+ "INNER JOIN patientdatavalue AS d " +
+ "WHERE d.programstageinstanceid=a.programstageinstanceid " +
+ "AND d.dataelementid=a.dataelementid " +
+ "AND d.organisationunitid=a.organisationunitid " +
+ "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
+ "AND a.timestamp<=d.timestamp;";
+ }
+
+ public String getPatientsByFullName( String fullName )
+ {
+ return "SELECT patientid FROM patient " +
+ "where lower(concat( firstname, \" \",middleName , \" \" , lastname) ) " +
+ "like lower('%" + fullName + "%') ";
+ }
+
+ public String getPatientsByFullName( String fullName, int min, int max )
+ {
+ return "SELECT patientid FROM patient " +
+ "where lower(concat( firstname, \" \",middleName , \" \" , lastname) ) " +
+ "like lower('%" + fullName + "%') " +
+ "limit " + min + " ," + max;
+ }
+
+ public String countPatientsByFullName( String fullName )
+ {
+ return "SELECT count(patientid) FROM patient " +
+ "where lower(concat( firstname, \" \",middleName , \" \" , lastname) ) " +
+ "like lower('%" + fullName + "%')";
+ }
+
+ public String queryDataElementStructureForOrgUnit()
+ {
+ StringBuffer sqlsb = new StringBuffer();
+ sqlsb.append( "(SELECT DISTINCT de.dataelementid, concat(de.name, \" \", cc.categoryoptioncomboname) AS DataElement " );
+ sqlsb.append( "FROM dataelement AS de " );
+ sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
+ sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
+ sqlsb.append( "ORDER BY DataElement) " );
+ return sqlsb.toString();
+ }
+
+ public String queryRawDataElementsForOrgUnitBetweenPeriods(Integer orgUnitId, List<Integer> betweenPeriodIds)
{
StringBuffer sqlsb = new StringBuffer();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java 2011-04-26 02:06:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java 2011-05-02 18:40:36 +0000
@@ -218,7 +218,7 @@
{
OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
- getParamsToSearch();
+ setParamsToSearch();
// ---------------------------------------------------------------------
// Get all of patient into the selected organisation unit
@@ -330,14 +330,12 @@
searchText = selectedStateManager.getSearchText();
program = selectedStateManager.getSelectedProgram();
- getParamsToSearch();
+ setParamsToSearch();
if ( listAll )
{
listAllPatient( organisationUnit, sortingPatientAttribute );
-
return SUCCESS;
-
}
if ( searchingAttributeId != null && searchingAttributeId == 0 && program != null )
@@ -365,7 +363,7 @@
// Supporting methods
// -------------------------------------------------------------------------
- private void getParamsToSearch()
+ private void setParamsToSearch()
{
// ---------------------------------------------------------------------
// Get sorting patient-attribute
@@ -414,7 +412,6 @@
PatientAttribute sortingPatientAttribute )
{
total = patientService.countGetPatientsByOrgUnitProgram( organisationUnit, program );
-
this.paging = createPaging( total );
patients = new ArrayList<Patient>( patientService.getPatients( organisationUnit, program, paging.getStartPos(),
@@ -424,7 +421,7 @@
{
for ( Patient patient : patients )
{
-// mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
+ // mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
if ( sortingPatientAttribute != null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAndProgramMenu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAndProgramMenu.vm 2011-04-28 09:19:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAndProgramMenu.vm 2011-05-02 18:40:36 +0000
@@ -5,10 +5,10 @@
<li><a href="patientAttributeGroup.action">$i18n.getString( "patient_attribute_group" )</a></li>
<li><a href="patientIdentifierType.action">$i18n.getString( "patient_identifier_type" )</a></li>
<li><a href="relationshipType.action">$i18n.getString( "relationship_type" )</a></li>
- <li><a href="defineOrgunitRegistrationForm.action">$i18n.getString( "patient_orgunit_registration" )</a></li>
+ <li><a href="defineOrgunitRegistrationForm.action">$i18n.getString( "patient_registration" )</a></li>
<li><a href="program.action">$i18n.getString( "program" )</a></li>
<li><a href="programAttribute.action">$i18n.getString( "program_attribute" )</a></li>
- <li><a href="caseAggregation.action">$i18n.getString( "beneficiary_aggregation_query_builder" )</a></li>
+ <li><a href="caseAggregation.action">$i18n.getString( "beneficiary_aggregation" )</a></li>
<li><a href="validationCriteria.action">$i18n.getString( "validation_criteria" )</a></li>
<li><a href="patientMobileSetting.action">$i18n.getString( "patient_mobile_setting" )</a></li>
</ul>