dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24655
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12127: Removed program list from Patient object.
------------------------------------------------------------
revno: 12127
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-09-18 10:49:35 +0700
message:
Removed program list from Patient object.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SetProgramInstanceStatusAction.java
dhis-2/dhis-web/dhis-web-caseentry/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-api/src/main/java/org/hisp/dhis/patient/Patient.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java 2013-09-17 07:53:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java 2013-09-18 03:49:35 +0000
@@ -28,24 +28,23 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-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;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashSet;
+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.Program;
import org.hisp.dhis.user.User;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
+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.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
/**
* @author Abyot Asalefew Gizaw
@@ -99,9 +98,7 @@
private boolean isDead = false;
private Set<PatientIdentifier> identifiers = new HashSet<PatientIdentifier>();
-
- private Set<Program> programs = new HashSet<Program>();
-
+
private OrganisationUnit organisationUnit;
private Set<PatientAttribute> attributes = new HashSet<PatientAttribute>();
@@ -216,21 +213,7 @@
{
this.identifiers = identifiers;
}
-
- @JsonProperty
- @JsonView({ DetailedView.class, ExportView.class })
- @JacksonXmlElementWrapper(localName = "programs", namespace = DxfNamespaces.DXF_2_0)
- @JacksonXmlProperty(localName = "program", namespace = DxfNamespaces.DXF_2_0)
- public Set<Program> getPrograms()
- {
- return programs;
- }
-
- public void setPrograms( Set<Program> programs )
- {
- this.programs = programs;
- }
-
+
@JsonProperty
@JsonSerialize(as = BaseIdentifiableObject.class)
@JsonView({ DetailedView.class, ExportView.class })
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2013-09-12 07:29:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2013-09-18 03:49:35 +0000
@@ -262,9 +262,7 @@
int countGetPatientsByOrgUnitProgram( OrganisationUnit organisationUnit, Program program );
Object getObjectValue( String property, String value, I18nFormat format );
-
- void removeErollmentPrograms( Program program );
-
+
Collection<Patient> searchPatients( List<String> searchKeys, Collection<OrganisationUnit> orgunit,
Boolean followup, Collection<PatientAttribute> patientAttributes, Integer min, Integer max );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 2013-09-12 07:26:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 2013-09-18 03:49:35 +0000
@@ -69,8 +69,6 @@
int countGetPatientsByOrgUnitProgram( OrganisationUnit organisationUnit, Program program );
- void removeErollmentPrograms( Program program );
-
int countSearch( List<String> searchKeys, Collection<OrganisationUnit> orgunit, Boolean followup );
Collection<Patient> getByPhoneNumber( String phoneNumber, Integer min, Integer max );
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2013-09-12 07:29:29 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2013-09-18 03:49:35 +0000
@@ -437,8 +437,8 @@
for ( Patient each : patients )
{
- patientsInfo += each.getId() + "/" + each.getName() + "/"
- + dateFormat.format( each.getBirthDate() ) + "$";
+ patientsInfo += each.getId() + "/" + each.getName() + "/" + dateFormat.format( each.getBirthDate() )
+ + "$";
}
throw new NotAllowedException( patientsInfo );
@@ -490,9 +490,6 @@
programInstance.setStatus( ProgramInstance.STATUS_COMPLETED );
programInstance.setPatient( patient );
- patient.getPrograms().add( programStage.getProgram() );
- patientService.updatePatient( patient );
-
programInstanceService.addProgramInstance( programInstance );
// ---------------------------------------------------------------------
@@ -676,8 +673,6 @@
programInstance.setPatient( patient );
programInstance.setStatus( ProgramInstance.STATUS_ACTIVE );
programInstanceService.addProgramInstance( programInstance );
- patient.getPrograms().add( program );
- patientService.updatePatient( patient );
for ( ProgramStage programStage : program.getProgramStages() )
{
if ( programStage.getAutoGenerateEvent() )
@@ -1290,8 +1285,8 @@
for ( Patient each : patients )
{
- patientsInfo += each.getId() + "/" + each.getName() + "/"
- + dateFormat.format( each.getBirthDate() ) + "$";
+ patientsInfo += each.getId() + "/" + each.getName() + "/" + dateFormat.format( each.getBirthDate() )
+ + "$";
}
throw new NotAllowedException( patientsInfo );
@@ -1921,8 +1916,8 @@
}
if ( each.getBirthDate() != null )
{
- patientsInfo += each.getId() + "/" + each.getName() + "/"
- + dateFormat.format( each.getBirthDate() ) + "$";
+ patientsInfo += each.getId() + "/" + each.getName() + "/" + dateFormat.format( each.getBirthDate() )
+ + "$";
}
else
{
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2013-09-12 07:26:17 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2013-09-18 03:49:35 +0000
@@ -566,11 +566,6 @@
return patientStore.getRepresentatives( patient );
}
- public void removeErollmentPrograms( Program program )
- {
- patientStore.removeErollmentPrograms( program );
- }
-
public Collection<Patient> searchPatients( List<String> searchKeys, Collection<OrganisationUnit> orgunits,
Boolean followup, Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
{
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java 2013-09-10 13:40:30 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java 2013-09-18 03:49:35 +0000
@@ -28,13 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.Collection;
+
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.program.Program;
import org.hisp.dhis.system.deletion.DeletionHandler;
import org.springframework.jdbc.core.JdbcTemplate;
-import java.util.Collection;
-
public class PatientDeletionHandler
extends DeletionHandler
{
@@ -91,9 +90,4 @@
return patientService.getPatients( unit, 0, Integer.MAX_VALUE ).size() == 0 ? null : ERROR;
}
- @Override
- public void deleteProgram( Program program )
- {
- patientService.removeErollmentPrograms( program );
- }
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2013-09-17 07:53:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2013-09-18 03:49:35 +0000
@@ -311,14 +311,6 @@
}
@Override
- public void removeErollmentPrograms( Program program )
- {
- String sql = "delete from patient_programs where programid='" + program.getId() + "'";
-
- jdbcTemplate.execute( sql );
- }
-
- @Override
public Collection<Patient> search( List<String> searchKeys, Collection<OrganisationUnit> orgunits,
Boolean followup, Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
{
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-09-16 09:47:59 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-09-18 03:49:35 +0000
@@ -197,37 +197,36 @@
executeSql( "update caseaggregationcondition set \"operator\"='times' where \"operator\"='SUM'" );
executeSql( "update prorgam set \"operator\"='times' where \"operator\"='SUM'" );
-
+
executeSql( "update program set remindCompleted=false where remindCompleted is null" );
executeSql( "update patientreminder set dateToCompare='duedate' where programstageid is not null" );
executeSql( "UPDATE programinstance SET followup=false where followup is null" );
executeSql( "UPDATE patientreminder SET sendTo=1 where sendTo is null" );
-
-
+
updateUid();
updateUidInDataEntryFrom();
updateProgramInstanceStatus();
-
+
executeSql( "ALTER TABLE program DROP COLUMN disableRegistrationFields" );
- executeSql( "ALTER TABLE program ALTER COLUMN dateofincidentdescription DROP NOT NULL");
- executeSql( "ALTER TABLE patient ALTER COLUMN birthdate DROP NOT NULL");
- executeSql( "ALTER TABLE patient ALTER COLUMN gender DROP NOT NULL");
- executeSql( "ALTER TABLE patient ALTER COLUMN underage DROP NOT NULL");
- executeSql( "ALTER TABLE program ALTER COLUMN dateofenrollmentdescription DROP NOT NULL");
+ executeSql( "ALTER TABLE program ALTER COLUMN dateofincidentdescription DROP NOT NULL" );
+ executeSql( "ALTER TABLE patient ALTER COLUMN birthdate DROP NOT NULL" );
+ executeSql( "ALTER TABLE patient ALTER COLUMN gender DROP NOT NULL" );
+ executeSql( "ALTER TABLE patient ALTER COLUMN underage DROP NOT NULL" );
+ executeSql( "ALTER TABLE program ALTER COLUMN dateofenrollmentdescription DROP NOT NULL" );
executeSql( "UPDATE program SET displayOnAllOrgunit=true where displayOnAllOrgunit is null" );
executeSql( "UPDATE program SET useFormNameDataElement=true where useFormNameDataElement is null" );
- executeSql( "ALTER TABLE caseaggregationcondition ALTER COLUMN aggregationexpression TYPE varchar(1000)");
- executeSql( "update patientattribute set displayonvisitschedule = false where displayonvisitschedule is null");
- executeSql( "update program set useBirthDateAsIncidentDate = false where useBirthDateAsIncidentDate is null");
- executeSql( "update program set useBirthDateAsEnrollmentDate = false where useBirthDateAsEnrollmentDate is null");
- executeSql( "update program set selectEnrollmentDatesInFuture = false where selectEnrollmentDatesInFuture is null");
- executeSql( "update program set selectIncidentDatesInFuture = false where selectIncidentDatesInFuture is null");
- executeSql( "update validationcriteria set description = name where description is null or description='' ");
- executeSql( "update programstage set generatedByEnrollmentDate = false where generatedByEnrollmentDate is null ");
- executeSql( "update programstage set blockEntryForm = false where blockEntryForm is null ");
- executeSql( "update programstage set remindCompleted = false where remindCompleted is null ");
+ executeSql( "ALTER TABLE caseaggregationcondition ALTER COLUMN aggregationexpression TYPE varchar(1000)" );
+ executeSql( "update patientattribute set displayonvisitschedule = false where displayonvisitschedule is null" );
+ executeSql( "update program set useBirthDateAsIncidentDate = false where useBirthDateAsIncidentDate is null" );
+ executeSql( "update program set useBirthDateAsEnrollmentDate = false where useBirthDateAsEnrollmentDate is null" );
+ executeSql( "update program set selectEnrollmentDatesInFuture = false where selectEnrollmentDatesInFuture is null" );
+ executeSql( "update program set selectIncidentDatesInFuture = false where selectIncidentDatesInFuture is null" );
+ executeSql( "update validationcriteria set description = name where description is null or description='' " );
+ executeSql( "update programstage set generatedByEnrollmentDate = false where generatedByEnrollmentDate is null " );
+ executeSql( "update programstage set blockEntryForm = false where blockEntryForm is null " );
+ executeSql( "update programstage set remindCompleted = false where remindCompleted is null " );
executeSql( "ALTER TABLE program DROP COLUMN generatedByEnrollmentDate" );
executeSql( "ALTER TABLE program DROP COLUMN blockEntryForm" );
executeSql( "ALTER TABLE program DROP COLUMN remindCompleted" );
@@ -240,6 +239,8 @@
executeSql( "alter table patient drop column firstname" );
executeSql( "alter table patient drop column middlename" );
executeSql( "alter table patient drop column lastname" );
+
+ executeSql( "DROP TABLE patient_programs" );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml 2013-09-12 07:33:02 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml 2013-09-18 03:49:35 +0000
@@ -34,12 +34,7 @@
<key column="patientid" />
<one-to-many class="org.hisp.dhis.patient.PatientIdentifier" />
</set>
-
- <set name="programs" table="patient_programs">
- <key column="patientid" foreign-key="fk_patient_programs_patientid" />
- <many-to-many class="org.hisp.dhis.program.Program" column="programid" foreign-key="fk_patient_programid" />
- </set>
-
+
<set name="attributes" table="patient_attributes">
<key column="patientid" foreign-key="fk_patient_attributes_patientid" />
<many-to-many class="org.hisp.dhis.patient.PatientAttribute" column="patientattributeid"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java 2013-09-10 04:51:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java 2013-09-18 03:49:35 +0000
@@ -36,9 +36,7 @@
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.message.MessageConversation;
-import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientReminder;
-import org.hisp.dhis.patient.PatientService;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramInstance;
@@ -74,13 +72,6 @@
this.programInstanceService = programInstanceService;
}
- private PatientService patientService;
-
- public void setPatientService( PatientService patientService )
- {
- this.patientService = patientService;
- }
-
private CurrentUserService currentUserService;
public void setCurrentUserService( CurrentUserService currentUserService )
@@ -226,13 +217,6 @@
programInstanceService.updateProgramInstance( programInstance );
- Program program = programInstance.getProgram();
- if ( !program.getOnlyEnrollOnce() )
- {
- Patient patient = programInstance.getPatient();
- patient.getPrograms().remove( program );
- patientService.updatePatient( patient );
- }
}
return "programcompleted";
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java 2013-09-18 03:49:35 +0000
@@ -113,7 +113,6 @@
// ---------------------------------------------------------------------
programs = programService.getPrograms( orgunit );
- programs.retainAll( patient.getPrograms() );
programs.retainAll( programService.getProgramsByCurrentUser());
selectedStateManager.setSelectedPatient( patient );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java 2013-09-18 03:49:35 +0000
@@ -203,8 +203,6 @@
programInstance.setStatus( ProgramInstance.STATUS_ACTIVE );
programInstance.setPatient( patient );
- patient.getPrograms().add( program );
- patientService.updatePatient( patient );
programInstanceService.addProgramInstance( programInstance );
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java 2013-09-18 03:49:35 +0000
@@ -164,9 +164,6 @@
programInstance.setStatus( ProgramInstance.STATUS_COMPLETED );
programInstance.setPatient( patient );
- patient.getPrograms().add( program );
- patientService.updatePatient( patient );
-
programInstanceService.addProgramInstance( programInstance );
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java 2013-09-18 03:49:35 +0000
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Iterator;
import org.hisp.dhis.caseentry.state.SelectedStateManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -122,7 +123,15 @@
programs.addAll( programService.getProgramsByDisplayOnAllOrgunit( false, orgunit ) );
programs.retainAll( programService.getProgramsByCurrentUser() );
programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
- programs.removeAll( patient.getPrograms() );
+
+ Iterator<Program> iterProgram = programs.iterator();
+ while(iterProgram.hasNext() )
+ {
+ if( iterProgram.next().getOnlyEnrollOnce())
+ {
+ iterProgram.remove();
+ }
+ }
Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, ProgramInstance.STATUS_ACTIVE );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java 2013-09-10 14:33:19 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java 2013-09-18 03:49:35 +0000
@@ -205,9 +205,6 @@
programInstanceService.addProgramInstance( programInstance );
- patient.getPrograms().add( program );
- patientService.updatePatient( patient );
-
boolean isFirstStage = false;
Date currentDate = new Date();
for ( ProgramStage programStage : program.getProgramStages() )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SetProgramInstanceStatusAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SetProgramInstanceStatusAction.java 2013-09-10 04:51:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SetProgramInstanceStatusAction.java 2013-09-18 03:49:35 +0000
@@ -36,9 +36,7 @@
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.message.MessageConversation;
-import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientReminder;
-import org.hisp.dhis.patient.PatientService;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramInstance;
@@ -60,13 +58,6 @@
// Dependencies
// -------------------------------------------------------------------------
- private PatientService patientService;
-
- public void setPatientService( PatientService patientService )
- {
- this.patientService = patientService;
- }
-
private ProgramInstanceService programInstanceService;
public void setProgramInstanceService( ProgramInstanceService programInstanceService )
@@ -125,10 +116,6 @@
throws Exception
{
ProgramInstance programInstance = programInstanceService.getProgramInstance( programInstanceId );
-
- Patient patient = programInstance.getPatient();
-
- Program program = programInstance.getProgram();
programInstance.setStatus( status );
if ( status == ProgramInstance.STATUS_COMPLETED )
@@ -160,11 +147,6 @@
PatientReminder.SEND_WHEN_TO_C0MPLETED_PROGRAM, format ) );
programInstance.setEndDate( new Date() );
- if ( !program.getOnlyEnrollOnce() )
- {
- patient.getPrograms().remove( program );
- patientService.updatePatient( patient );
- }
}
else if ( status == ProgramInstance.STATUS_CANCELLED )
@@ -192,15 +174,10 @@
}
}
}
- patient.getPrograms().remove( program );
- patientService.updatePatient( patient );
}
else
{
programInstance.setEndDate( null );
-
- patient.getPrograms().add( program );
- patientService.updatePatient( patient );
}
programInstanceService.updateProgramInstance( programInstance );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-09-18 02:45:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-09-18 03:49:35 +0000
@@ -2,7 +2,6 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
-
<!-- Selection -->
<bean id="org.hisp.dhis.caseentry.state.SelectedStateManager"
@@ -120,7 +119,6 @@
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
- <property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
</bean>
@@ -701,7 +699,6 @@
id="org.hisp.dhis.caseentry.action.patient.SetProgramInstanceStatusAction"
class="org.hisp.dhis.caseentry.action.patient.SetProgramInstanceStatusAction"
scope="prototype">
- <property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />