=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2010-02-22 09:19:15 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2010-06-23 19:59:35 +0000 @@ -57,6 +57,8 @@ private boolean mandatory; + private boolean inheritable; + private PatientAttributeGroup patientAttributeGroup; private Set attributeOptions; @@ -189,4 +191,12 @@ this.patientAttributeGroup = patientAttributeGroup; } + public boolean isInheritable() { + return inheritable; + } + + public void setInheritable(boolean inheritable) { + this.inheritable = inheritable; + } + } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java 2010-05-11 16:29:50 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java 2010-06-23 19:59:35 +0000 @@ -112,7 +112,7 @@ { return (Patient) getCriteria( Restrictions.and( Restrictions.eq( "identifierType", idenType ), Restrictions.eq( "identifier", value ) ) ) - .setProjection( Projections.property( "patient.id" ) ).uniqueResult(); + .setProjection( Projections.property( "patient" ) ).uniqueResult(); } public int countListPatientByOrganisationUnit( OrganisationUnit orgUnit ) === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml 2010-02-22 09:19:15 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml 2010-06-23 19:59:35 +0000 @@ -16,6 +16,8 @@ + + > mapRelationShip = new HashMap>(); + + public Map> getMapRelationShip( ) + { + return mapRelationShip; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -214,6 +232,14 @@ patients = patientService.getPatientsByOrgUnit( organisationUnit , pagingUtil.getStartPos(), pagingUtil.getPageSize() ); + if( patients != null && patients.size() > 0 ) + { + for( Patient patient : patients ) + { + mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); + } + } + searchText = "list_all_patients"; return SUCCESS; @@ -241,6 +267,14 @@ patients = patientAttributeValueService.searchPatientAttributeValue( patientAttribute, searchText, pagingUtil.getStartPos(), pagingUtil.getPageSize() ); + if( patients != null && patients.size() > 0 ) + { + for( Patient patient : patients ) + { + mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); + } + } + return SUCCESS; } @@ -261,6 +295,14 @@ patients = patientService.getPatients( searchText, pagingUtil.getStartPos(), pagingUtil.getPageSize() ); + if( patients != null && patients.size() > 0 ) + { + for( Patient patient : patients ) + { + mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); + } + } + return SUCCESS; } @@ -283,6 +325,14 @@ patients = patientService.getPatientsByOrgUnit( organisationUnit , pagingUtil.getStartPos(), pagingUtil.getPageSize() ); + if( patients != null && patients.size() > 0 ) + { + for( Patient patient : patients ) + { + mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); + } + } + searchText = "list_all_patients"; return SUCCESS; @@ -308,6 +358,14 @@ patients = patientAttributeValueService.searchPatientAttributeValue( patientAttribute, searchText, pagingUtil.getStartPos(), pagingUtil.getPageSize() ); + + if( patients != null && patients.size() > 0 ) + { + for( Patient patient : patients ) + { + mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); + } + } } @@ -321,6 +379,13 @@ patients = patientService.getPatients( searchText, pagingUtil.getStartPos(), pagingUtil.getPageSize() ); + if( patients != null && patients.size() > 0 ) + { + for( Patient patient : patients ) + { + mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); + } + } return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java 2010-02-22 09:19:15 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java 2010-06-23 19:59:35 +0000 @@ -93,6 +93,13 @@ this.mandatory = mandatory; } + private boolean inheritable; + + public void setInheritable( boolean inheritable ) + { + this.inheritable = inheritable; + } + private List attrOptions; public void setAttrOptions( List attrOptions ) @@ -113,6 +120,7 @@ patientAttribute.setDescription( description ); patientAttribute.setValueType( valueType ); patientAttribute.setMandatory( mandatory ); + patientAttribute.setInheritable( inheritable ); patientAttributeService.savePatientAttribute( patientAttribute ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java 2010-02-22 09:19:15 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java 2010-06-23 19:59:35 +0000 @@ -106,6 +106,13 @@ this.mandatory = mandatory; } + private boolean inheritable; + + public void setInheritable( boolean inheritable ) + { + this.inheritable = inheritable; + } + private List attrOptions; public void setAttrOptions( List attrOptions ) @@ -126,6 +133,7 @@ patientAttribute.setDescription( description ); patientAttribute.setValueType( valueType ); patientAttribute.setMandatory( mandatory ); + patientAttribute.setInheritable( inheritable ); HttpServletRequest request = ServletActionContext.getRequest(); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowAddRelationshipPatientAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowAddRelationshipPatientAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowAddRelationshipPatientAction.java 2010-06-23 19:59:35 +0000 @@ -39,7 +39,10 @@ import org.hisp.dhis.patient.PatientIdentifier; import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientIdentifierTypeService; +import org.hisp.dhis.patient.PatientService; import org.hisp.dhis.patient.state.SelectedStateManager; +import org.hisp.dhis.patientattributevalue.PatientAttributeValue; +import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; import org.hisp.dhis.relationship.RelationshipType; import org.hisp.dhis.relationship.RelationshipTypeService; @@ -57,37 +60,21 @@ // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- + + private PatientService patientService; private SelectedStateManager selectedStateManager; - public void setSelectedStateManager( SelectedStateManager selectedStateManager ) - { - this.selectedStateManager = selectedStateManager; - } - private PatientAttributeService patientAttributeService; - public void setPatientAttributeService( PatientAttributeService patientAttributeService ) - { - this.patientAttributeService = patientAttributeService; - } - private PatientAttributeGroupService patientAttributeGroupService; - public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService ) - { - this.patientAttributeGroupService = patientAttributeGroupService; - } - private PatientIdentifierTypeService patientIdentifierTypeService; - public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) - { - this.patientIdentifierTypeService = patientIdentifierTypeService; - } - private RelationshipTypeService relationshipTypeService; + private PatientAttributeValueService patientAttributeValueService; + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -104,6 +91,10 @@ private Map identiferMap; + private Map attributeMap; + + private Integer id; + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -115,11 +106,23 @@ noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup(); - attributeGroups = patientAttributeGroupService.getAllPatientAttributeGroups(); + attributeGroups = patientAttributeGroupService.getAllPatientAttributeGroups(); relationshipTypes = relationshipTypeService.getAllRelationshipTypes(); - patient = selectedStateManager.getSelectedPatient(); + if( id == null ) + { + patient = selectedStateManager.getSelectedPatient(); + } + else + { + patient = patientService.getPatient( id.intValue() ); + } + + if( patient == null ) + { + return ERROR; + } identiferMap = new HashMap(); @@ -128,7 +131,19 @@ if ( identifier.getIdentifierType() != null ) identiferMap.put( identifier.getIdentifierType().getId(), identifier.getIdentifier() ); } - + + attributeMap = new HashMap(); + + Collection attributeValues = patientAttributeValueService.getPatientAttributeValues( patient ); + + if( attributeValues != null && attributeValues.size() > 0 ) + { + for( PatientAttributeValue attributeValue : attributeValues ) + { + attributeMap.put( attributeValue.getPatientAttribute().getId(), attributeValue.getValue() ); + } + } + return SUCCESS; } @@ -136,6 +151,16 @@ // Getter/Setter // ------------------------------------------------------------------------- + public Integer getId() + { + return id; + } + + public void setId( Integer id ) + { + this.id = id; + } + public Collection getIdentifierTypes() { return identifierTypes; @@ -169,5 +194,39 @@ { return identiferMap; } - + + public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) + { + this.patientIdentifierTypeService = patientIdentifierTypeService; + } + + public void setSelectedStateManager( SelectedStateManager selectedStateManager ) + { + this.selectedStateManager = selectedStateManager; + } + + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) + { + this.patientAttributeService = patientAttributeService; + } + + public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService ) + { + this.patientAttributeGroupService = patientAttributeGroupService; + } + + public void setPatientService( PatientService patientService ) + { + this.patientService = patientService; + } + + public Map getAttributeMap() + { + return attributeMap; + } + + public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService ) + { + this.patientAttributeValueService = patientAttributeValueService; + } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2010-05-18 03:42:26 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2010-06-23 19:59:35 +0000 @@ -162,9 +162,15 @@ + + + + + + @@ -373,6 +379,8 @@ ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" /> + + + + + + + + + + #elseif( $attribute.valueType == "DATE" ) $i18n.getString( - + #elseif( $attribute.valueType == "COMBO" ) - #foreach ($option in $attribute.attributeOptions ) #end #else - + #end @@ -180,18 +181,20 @@ #if ( $noGroupAttributes.size() > 0) $i18n.getString( "other_details" ) #foreach($attribute in $noGroupAttributes ) + #set( $attributeValue = "" ) + #set( $attributeValue = $attributeMap.get( $attribute.id ) ) #if( $attribute.valueType == "YES/NO" ) - #elseif( $attribute.valueType == "DATE" ) $i18n.getString( - + #elseif( $attribute.valueType == "COMBO" ) - #foreach ($option in $attribute.attributeOptions ) #end #else - + #end === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js 2010-06-16 12:16:35 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js 2010-06-23 19:59:35 +0000 @@ -623,4 +623,73 @@ var pageSize = jQuery("#sizeOfPage").val(); var currentPage = jQuery("#jumpToPage").val(); window.location.href = baseLink +"pageSize=" + pageSize +"¤tPage=" +currentPage; -} \ No newline at end of file +} + +function toggleRelationshipRow(this_) +{ + if( jQuery(this_).attr("checked") ) + { + jQuery("tr.relationship-row").each(function(){jQuery(this).show()}); + }else { + jQuery("tr.relationship-row").each(function(){jQuery(this).hide()}); + } +} + +/** + * Overwrite showDetails() of common.js + * This method will show details div on a pop up instead of show the div in the main table's column. + * So we will have more place for the main column of the table. + * @return + */ + +function showDetails() +{ + var detailArea = $("#detailsArea"); + var top = (f_clientHeight() / 2) - 200; + if ( top < 0 ) top = 0; + var left = screen.width - detailArea.width() - 100; + detailArea.css({"left":left+"px","top":top+"px"}); + detailArea.show('fast'); + +} + +/** + * Get document width, hieght, scroll positions + * Work with all browsers + * @return + */ + +function f_clientWidth() { + return f_filterResults ( + window.innerWidth ? window.innerWidth : 0, + document.documentElement ? document.documentElement.clientWidth : 0, + document.body ? document.body.clientWidth : 0 + ); +} +function f_clientHeight() { + return f_filterResults ( + window.innerHeight ? window.innerHeight : 0, + document.documentElement ? document.documentElement.clientHeight : 0, + document.body ? document.body.clientHeight : 0 + ); +} +function f_scrollLeft() { + return f_filterResults ( + window.pageXOffset ? window.pageXOffset : 0, + document.documentElement ? document.documentElement.scrollLeft : 0, + document.body ? document.body.scrollLeft : 0 + ); +} +function f_scrollTop() { + return f_filterResults ( + window.pageYOffset ? window.pageYOffset : 0, + document.documentElement ? document.documentElement.scrollTop : 0, + document.body ? document.body.scrollTop : 0 + ); +} +function f_filterResults(n_win, n_docel, n_body) { + var n_result = n_win ? n_win : 0; + if (n_docel && (!n_result || (n_result > n_docel))) + n_result = n_docel; + return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result; +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js 2010-04-05 12:33:38 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js 2010-06-23 19:59:35 +0000 @@ -150,6 +150,15 @@ if( data.related ) { jQuery(this).val(""); + jQuery(this).attr({"disabled":""}); + } + }); + jQuery(".attrField").each(function(){ + var data = jQuery(this).metadata({type:"attr",name:"data"}); + if( data.inheritable ) + { + jQuery(this).val(""); +// jQuery(this).attr({"disabled":""}); } }); }else { @@ -161,6 +170,14 @@ jQuery(this).attr({"disabled":"disabled"}); } }); + jQuery(".attrField").each(function(){ + var data = jQuery(this).metadata({type:"attr",name:"data"}); + if( data.inheritable ) + { + jQuery(this).val(data.value); +// jQuery(this).attr({"disabled":"disabled"}); + } + }); } } function ageOnchange() === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm 2010-06-23 09:02:38 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm 2010-06-23 19:59:35 +0000 @@ -6,6 +6,12 @@ #set ($sText = "" ) #end + + + + @@ -20,7 +26,12 @@
$i18n.getString( "search_result_matching_the_search_criteria" )$total
- + + + + + +
@@ -38,7 +49,8 @@ - + + @@ -48,7 +60,7 @@ - @@ -59,13 +71,14 @@ - + #set( $mark = false ) #foreach( $patient in $patients ) + #set( $mark = !$mark) + + + - #if( $mark ) - #set( $mark = false ) - #else - #set( $mark = true ) + #set( $relationships = $mapRelationShip.get($patient.id)) + #foreach( $relationship in $relationships ) + + #set( $partnerId = false ) + #if( $relationship.patientA.id == $patient.id ) + #set( $partnerId = $relationship.patientB.id ) + #set ( $partner = $relationship.patientB ) + + #elseif($relationship.patientB.id == $patient.id ) + #set( $partnerId = $relationship.patientA.id ) + #set ( $partner = $relationship.patientA ) + + #end + + + + + + + + + + + + + + + + + + + + + + + #end #end
+
$i18n.getString( "gender" ) $i18n.getString( "date_of_birth" ) $i18n.getString( "age" )$i18n.getString( "operations" )$i18n.getString( "operations" )
#set( $nr = ( ( $pagingUtil.currentPage - 1 ) * $pagingUtil.pageSize ) + $velocityCount ) @@ -104,7 +117,11 @@ --> $i18n.getString( - + $i18n.getString( + $i18n.getString( @@ -115,27 +132,78 @@
+ $encoder.htmlEncode( $relationship.relationshipType.BIsToA ) + + $encoder.htmlEncode( $relationship.relationshipType.AIsToB ) + + $encoder.htmlEncode( $partner.firstName ) + + $encoder.htmlEncode( $partner.middleName ) + + $encoder.htmlEncode( $partner.lastName ) + + $encoder.htmlEncode( $partner.gender ) + + $format.formatDate( $partner.birthDate ) + + $encoder.htmlEncode( $partner.getAge() ) + + $i18n.getString( + + $i18n.getString( + + $i18n.getString( + + $i18n.getString( + + $i18n.getString( + + $i18n.getString( + + $i18n.getString( +
- - - - @@ -153,3 +221,11 @@ var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")'; + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2010-03-05 06:24:12 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2010-06-23 19:59:35 +0000 @@ -54,8 +54,19 @@ + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm 2010-06-16 12:16:35 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm 2010-06-23 19:59:35 +0000 @@ -107,6 +107,7 @@ #if($patient.underAge) + #set( $representative = $patient.representative ) $i18n.getString("representative") $patient.representative.getFullName() $i18n.getString( @@ -120,14 +121,8 @@ #set( $identifier = "" ) #set( $identifier = $identiferMap.get( $identifierType.id ) ) - - #if($identifierType.format == "State Format") - - --- - #else - - #end - + + #end   @@ -262,25 +257,25 @@ - + - + - + - + - + - #foreach( $patientIdentifier in $patient.identifiers ) + #foreach( $patientIdentifier in $representative.identifiers ) @@ -289,7 +284,7 @@
$i18n.getString("full_name")$patient.getFullName()$representative.getFullName()
$i18n.getString("gender") $patient.gender $representative.gender
$i18n.getString("birth_date")$format.formatDate( $patient.birthDate )$format.formatDate( $representative.birthDate )
$i18n.getString("age") $patient.getAge() $representative.getAge()
$i18n.getString("blood_group")$patient.getBloodGroup()$representative.getBloodGroup()
#if( $patientIdentifier.identifierType )$patientIdentifier.identifierType.name #else $i18n.getString("system_identifier") #end $patientIdentifier.identifier
$i18n.getString("programs") - #foreach( $program in $patient.programs ) + #foreach( $program in $representative.programs ) #if( $velocityCount == 1 ) $program.name #else , $program.name