=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/AddNewRalationshipAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/AddNewRalationshipAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/AddNewRalationshipAction.java 2012-06-11 10:11:21 +0000
@@ -0,0 +1,134 @@
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.relationship.Relationship;
+import org.hisp.dhis.relationship.RelationshipService;
+import org.hisp.dhis.relationship.RelationshipTypeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddNewRalationshipAction
+ implements Action
+{
+ private static final String REDIRECT = "redirect";
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private RelationshipService relationshipService;
+
+ public RelationshipService getRelationshipService()
+ {
+ return relationshipService;
+ }
+
+ public void setRelationshipService( RelationshipService relationshipService )
+ {
+ this.relationshipService = relationshipService;
+ }
+
+ private RelationshipTypeService relationshipTypeService;
+
+ public RelationshipTypeService getRelationshipTypeService()
+ {
+ return relationshipTypeService;
+ }
+
+ public void setRelationshipTypeService( RelationshipTypeService relationshipTypeService )
+ {
+ this.relationshipTypeService = relationshipTypeService;
+ }
+
+ private PatientService patientService;
+
+ public PatientService getPatientService()
+ {
+ return patientService;
+ }
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer relatedPatientId;
+
+ public Integer getRelatedPatientId()
+ {
+ return relatedPatientId;
+ }
+
+ public void setRelatedPatientId( Integer relatedPatientId )
+ {
+ this.relatedPatientId = relatedPatientId;
+ }
+
+ private Integer originalPatientId;
+
+ public void setOriginalPatientId( Integer originalPatientId )
+ {
+ this.originalPatientId = originalPatientId;
+ }
+
+ public Integer getOriginalPatientId()
+ {
+ return originalPatientId;
+ }
+
+ private Integer relationshipTypeId;
+
+ public Integer getRelationshipTypeId()
+ {
+ return relationshipTypeId;
+ }
+
+ public void setRelationshipTypeId( Integer relationshipTypeId )
+ {
+ this.relationshipTypeId = relationshipTypeId;
+ }
+
+ private String relationship;
+
+ public String getRelationship()
+ {
+ return relationship;
+ }
+
+ public void setRelationship( String relationship )
+ {
+ this.relationship = relationship;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ Relationship newRelationship = new Relationship();
+ Patient patientA = patientService.getPatient( originalPatientId );
+ Patient patientB = patientService.getPatient( relatedPatientId );
+
+ newRelationship.setRelationshipType( relationshipTypeService.getRelationshipType( relationshipTypeId ) );
+
+ if ( relationship.equals( "A" ) )
+ {
+ newRelationship.setPatientA( patientA );
+ newRelationship.setPatientB( patientB );
+ }
+ else
+ {
+ newRelationship.setPatientA( patientB );
+ newRelationship.setPatientB( patientA );
+ }
+
+ relationshipService.saveRelationship( newRelationship );
+
+ return REDIRECT;
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/FindBeneficiarytAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/FindBeneficiarytAction.java 2012-06-05 07:38:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/FindBeneficiarytAction.java 2012-06-11 10:11:21 +0000
@@ -35,6 +35,7 @@
implements Action
{
private static final String REDIRECT = "redirect";
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -90,9 +91,9 @@
{
this.organisationUnitId = organisationUnitId;
}
-
+
private Integer patientId;
-
+
public Integer getPatientId()
{
return patientId;
@@ -103,6 +104,32 @@
this.patientId = patientId;
}
+ // Use in search related patient
+
+ private Integer originalPatientId;
+
+ public void setOriginalPatientId( Integer originalPatientId )
+ {
+ this.originalPatientId = originalPatientId;
+ }
+
+ public Integer getOriginalPatientId()
+ {
+ return originalPatientId;
+ }
+
+ private Integer relationshipTypeId;
+
+ public Integer getRelationshipTypeId()
+ {
+ return relationshipTypeId;
+ }
+
+ public void setRelationshipTypeId( Integer relationshipTypeId )
+ {
+ this.relationshipTypeId = relationshipTypeId;
+ }
+
@Override
public String execute()
throws Exception
@@ -119,7 +146,8 @@
}
patients = patientService.getPatientsForMobile( keyword, organisationUnitId );
- if (patients.size() == 1) {
+ if ( patients.size() == 1 )
+ {
Patient patient = patients.iterator().next();
patientId = patient.getId();
return REDIRECT;
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetAddNewRelationshipFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetAddNewRelationshipFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetAddNewRelationshipFormAction.java 2012-06-11 10:11:21 +0000
@@ -0,0 +1,126 @@
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.relationship.RelationshipType;
+import org.hisp.dhis.relationship.RelationshipTypeService;
+import com.opensymphony.xwork2.Action;
+
+public class GetAddNewRelationshipFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private RelationshipTypeService relationshipTypeService;
+
+ public RelationshipTypeService getRelationshipTypeService()
+ {
+ return relationshipTypeService;
+ }
+
+ public void setRelationshipTypeService( RelationshipTypeService relationshipTypeService )
+ {
+ this.relationshipTypeService = relationshipTypeService;
+ }
+
+ private PatientService patientService;
+
+ public PatientService getPatientService()
+ {
+ return patientService;
+ }
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer relatedPatientId;
+
+ public Integer getRelatedPatientId()
+ {
+ return relatedPatientId;
+ }
+
+ public void setRelatedPatientId( Integer relatedPatientId )
+ {
+ this.relatedPatientId = relatedPatientId;
+ }
+
+ private Integer originalPatientId;
+
+ public Integer getOriginalPatientId()
+ {
+ return originalPatientId;
+ }
+
+ public void setOriginalPatientId( Integer originalPatientId )
+ {
+ this.originalPatientId = originalPatientId;
+ }
+
+ private Integer relationshipTypeId;
+
+ public Integer getRelationshipTypeId()
+ {
+ return relationshipTypeId;
+ }
+
+ public void setRelationshipTypeId( Integer relationshipTypeId )
+ {
+ this.relationshipTypeId = relationshipTypeId;
+ }
+
+ private Patient relatedPatient;
+
+ public Patient getRelatedPatient()
+ {
+ return relatedPatient;
+ }
+
+ public void setRelatedPatient( Patient relatedPatient )
+ {
+ this.relatedPatient = relatedPatient;
+ }
+
+ private Patient originalPatient;
+
+ public Patient getOriginalPatient()
+ {
+ return originalPatient;
+ }
+
+ public void setOriginalPatient( Patient originalPatient )
+ {
+ this.originalPatient = originalPatient;
+ }
+
+ private RelationshipType relationshipType;
+
+ public RelationshipType getRelationshipType()
+ {
+ return relationshipType;
+ }
+
+ public void setRelationshipType( RelationshipType relationshipType )
+ {
+ this.relationshipType = relationshipType;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ originalPatient = patientService.getPatient( originalPatientId );
+ relatedPatient = patientService.getPatient( relatedPatientId );
+ relationshipType = relationshipTypeService.getRelationshipType( relationshipTypeId );
+
+ return SUCCESS;
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetFindBeneficiaryFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetFindBeneficiaryFormAction.java 2012-06-05 09:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetFindBeneficiaryFormAction.java 2012-06-11 10:11:21 +0000
@@ -70,6 +70,32 @@
{
this.organisationUnits = organisationUnits;
}
+
+ //use in find relation person
+
+ private Integer originalPatientId;
+
+ public Integer getOriginalPatientId()
+ {
+ return originalPatientId;
+ }
+
+ public void setOriginalPatientId( Integer originalPatientId )
+ {
+ this.originalPatientId = originalPatientId;
+ }
+
+ private Integer relationshipTypeId;
+
+ public Integer getRelationshipTypeId()
+ {
+ return relationshipTypeId;
+ }
+
+ public void setRelationshipTypeId( Integer relationshipTypeId )
+ {
+ this.relationshipTypeId = relationshipTypeId;
+ }
@Override
public String execute()
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java 2012-06-05 07:38:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java 2012-06-11 10:11:21 +0000
@@ -42,6 +42,8 @@
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.relationship.Relationship;
import org.hisp.dhis.relationship.RelationshipService;
+import org.hisp.dhis.relationship.RelationshipType;
+import org.hisp.dhis.relationship.RelationshipTypeService;
import com.opensymphony.xwork2.Action;
@@ -111,6 +113,18 @@
{
this.relationshipService = relationshipService;
}
+
+ public RelationshipTypeService relationshipTypeService;
+
+ public RelationshipTypeService getRelationshipTypeService()
+ {
+ return relationshipTypeService;
+ }
+
+ public void setRelationshipTypeService( RelationshipTypeService relationshipTypeService )
+ {
+ this.relationshipTypeService = relationshipTypeService;
+ }
// -------------------------------------------------------------------------
// Input & Output
@@ -163,7 +177,9 @@
{
this.enrollmentProgramList = enrollmentProgramList;
}
-
+
+ //Use for add relationship
+
private List
$i18n.getString( "add_relationship" )
+
+
+
+
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryList.vm 2012-06-05 07:38:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryList.vm 2012-06-11 10:11:21 +0000
@@ -1,11 +1,5 @@
$i18n.getString( "beneficiary_list" )
- #if( $validated)
- $i18n.getString("successfully_saved")
-
#foreach( $patient in $patients )
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm 2012-06-05 07:38:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm 2012-06-11 10:11:21 +0000
@@ -1,4 +1,11 @@
$!encoder.htmlEncode( ${patient.getFullName()} )
+ #if( $validated)
+ $i18n.getString("successfully_saved")
+
#foreach( $programInstance in $programInstances )
@@ -45,7 +52,16 @@
#foreach( $person in $relatedPeople )
-
+
+
+
Total found: $patients.size() #if($patients.size() == 0)$i18n.getString( "add_new_person" ) #end
+ + \ No newline at end of file