=== 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 relatedPeople; public List getRelatedPeople() @@ -175,6 +191,30 @@ { this.relatedPeople = relatedPeople; } + + private Collection relationshipTypes; + + public Collection getRelationshipTypes() + { + return relationshipTypes; + } + + public void setRelationshipTypes( Collection relationshipTypes ) + { + this.relationshipTypes = relationshipTypes; + } + + private Boolean validated; + + public Boolean getValidated() + { + return validated; + } + + public void setValidated( Boolean validated ) + { + this.validated = validated; + } @Override public String execute() @@ -207,7 +247,8 @@ relatedPeople.add( relationship.getPatientB() ); } } - + + relationshipTypes = relationshipTypeService.getAllRelationshipTypes(); return SUCCESS; } === added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetRelationshipFormAction.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetRelationshipFormAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetRelationshipFormAction.java 2012-06-11 10:11:21 +0000 @@ -0,0 +1,22 @@ +package org.hisp.dhis.light.namebaseddataentry.action; + +import com.opensymphony.xwork2.Action; + +public class GetRelationshipFormAction implements Action +{ + private Integer originalPatientId; + + private Integer relatedPatientId; + + private Integer relationshipTypeId; + + + @Override + public String execute() + throws Exception + { + // TODO Auto-generated method stub + return null; + } + +} === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-06-05 07:38:12 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-06-11 10:11:21 +0000 @@ -235,6 +235,8 @@ ref="org.hisp.dhis.program.ProgramService"/> + @@ -266,7 +268,28 @@ ref="org.hisp.dhis.program.ProgramStageService"/> + + + + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-06-05 07:38:12 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-06-11 10:11:21 +0000 @@ -86,4 +86,8 @@ please_select=Please Select enroll_in_program=Enroll In Program relationships=Relationships -phone_number=Phone Number \ No newline at end of file +phone_number=Phone Number +add_relationships=Add Relationships +related_person_search=Related Person Search +related_person_list=Related Person List +add_relationship=Add Relationship \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2012-06-05 07:38:12 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2012-06-11 10:11:21 +0000 @@ -159,6 +159,14 @@ /dhis-web-light/namebased/findBeneficiaryForm.vm + + + /dhis-web-light/main.vm + + /dhis-web-light/namebased/findRelatedPatientForm.vm + + showPatientProgramList.action?patientId=${patientId} @@ -168,6 +176,28 @@ /dhis-web-light/namebased/beneficiaryList.vm + + + /dhis-web-light/main.vm + + /dhis-web-light/namebased/addNewRelationshipForm.vm + + + + showAddNewRelationshipForm.action?originalPatientId=${originalPatientId}&relatedPatientId=${patientId}&relationshipTypeId=${relationshipTypeId} + + /dhis-web-light/main.vm + + /dhis-web-light/namebased/relatedPatientList.vm + + + + showPatientProgramList.action?patientId=${originalPatientId}&validated=true + + === added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/addNewRelationshipForm.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/addNewRelationshipForm.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/addNewRelationshipForm.vm 2012-06-11 10:11:21 +0000 @@ -0,0 +1,34 @@ +

$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")

-
- #else - - #end +

    #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")

    +
    + #else + + #end

      #foreach( $programInstance in $programInstances ) @@ -45,7 +52,16 @@

      +

      + +

      $i18n.getString("add_relationships")

      +

      +

      === added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/findRelatedPatientForm.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/findRelatedPatientForm.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/findRelatedPatientForm.vm 2012-06-11 10:11:21 +0000 @@ -0,0 +1,49 @@ +

      $i18n.getString( "related_person_search" )

      + + #if( $validated == true) +
      +

      $i18n.getString("successfully_saved")

      +
      + #else + + #end + +
      +
      + + +

      + + #if( $validationMap.get( "keyword" ) ) +
      $i18n.getString($validationMap.get( "fullName" )) + #end + +

      +

      + + +

      + +
      + +
      +

      + +

      +
      + +
      + + === added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/relatedPatientList.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/relatedPatientList.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/relatedPatientList.vm 2012-06-11 10:11:21 +0000 @@ -0,0 +1,24 @@ +

      $i18n.getString( "related_person_list" )

      + #if( $validated) +
      +

      $i18n.getString("successfully_saved")

      +
      + #else + + #end +

      +

      +

      +

      Total found: $patients.size() #if($patients.size() == 0)$i18n.getString( "add_new_person" ) #end

      + + \ No newline at end of file