dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19105
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8205: Pre-fill inherit patient-attribute-values when to register a new person for relationship.
------------------------------------------------------------
revno: 8205
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-09-23 16:30:13 +0700
message:
Pre-fill inherit patient-attribute-values when to register a new person for relationship.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java
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/struts.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm
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/UpdatePatientAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.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-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2012-09-23 09:30:13 +0000
@@ -66,6 +66,8 @@
private boolean mandatory;
+ private Boolean inherit;
+
private Boolean groupBy;
private PatientAttributeGroup patientAttributeGroup;
@@ -140,6 +142,16 @@
attributeOptions.add( option );
}
+ public void setInherit( Boolean inherit )
+ {
+ this.inherit = inherit;
+ }
+
+ public Boolean getInherit()
+ {
+ return inherit;
+ }
+
public Boolean isGroupBy()
{
return groupBy;
=== 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 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml 2012-09-23 09:30:13 +0000
@@ -30,5 +30,7 @@
<one-to-many class="org.hisp.dhis.patient.PatientAttributeOption" />
</set>
+ <property name="inherit" column="inherit"/>
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java 2012-09-11 07:31:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java 2012-09-23 09:30:13 +0000
@@ -47,6 +47,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 org.hisp.dhis.user.User;
import com.opensymphony.xwork2.Action;
@@ -76,10 +78,14 @@
private RelationshipService relationshipService;
+ private RelationshipTypeService relationshipTypeService;
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
+ private Collection<RelationshipType> relationshipTypes;
+
private int id;
private Patient patient;
@@ -117,6 +123,12 @@
public String execute()
throws Exception
{
+ relationshipTypes = relationshipTypeService.getAllRelationshipTypes();
+
+ // -------------------------------------------------------------------------
+ // Get identifier-types && attributes
+ // -------------------------------------------------------------------------
+
patient = patientService.getPatient( id );
programs = programService.getAllPrograms();
@@ -243,15 +255,25 @@
}
healthWorkers = patient.getOrganisationUnit().getUsers();
-
+
return SUCCESS;
-
+
}
// -----------------------------------------------------------------------------
// Getter / Setter
// -----------------------------------------------------------------------------
+ public void setRelationshipTypeService( RelationshipTypeService relationshipTypeService )
+ {
+ this.relationshipTypeService = relationshipTypeService;
+ }
+
+ public Collection<RelationshipType> getRelationshipTypes()
+ {
+ return relationshipTypes;
+ }
+
public Collection<User> getHealthWorkers()
{
return healthWorkers;
=== 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 2012-09-21 10:27:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-09-23 09:30:13 +0000
@@ -442,6 +442,8 @@
ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
<property name="relationshipService"
ref="org.hisp.dhis.relationship.RelationshipService" />
+ <property name="relationshipTypeService"
+ ref="org.hisp.dhis.relationship.RelationshipTypeService" />
</bean>
<bean id="org.hisp.dhis.caseentry.action.patient.AddPatientAction"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-09-23 06:14:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-09-23 09:30:13 +0000
@@ -731,7 +731,7 @@
</action>
<action name="showAddRelationshipPatient"
- class="org.hisp.dhis.caseentry.action.patient.ShowAddRelationshipPatientAction">
+ class="org.hisp.dhis.caseentry.action.patient.GetPatientAction">
<result name="success" type="velocity">/content.vm</result>
<param name="page">/dhis-web-caseentry/addRelationshipPatientForm.vm</param>
<param name="requiredAuthorities">F_PATIENT_ADD, F_RELATIONSHIP_ADD</param>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm 2012-09-21 03:50:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm 2012-09-23 09:30:13 +0000
@@ -33,6 +33,7 @@
datePickerValid( 'patientForm [id=birthDate]' );
addEventForPatientForm( 'patientForm' );
});
+ hideById('patientForm [id=age]');
hideById('patientManagementLbl');
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm 2012-09-21 03:50:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addRelationshipPatientForm.vm 2012-09-23 09:30:13 +0000
@@ -21,7 +21,12 @@
}
}
});
-
+ jQuery('#patientForm [id=fullName]').val("");
+ jQuery('#patientForm [inherit=false]').val("");
+ jQuery('#patientForm [inherit=]').val("");
+ jQuery('#patientForm [id=healthWorkerId]').val("");
+ jQuery('#patientForm [id^="iden"]').val("");
+ hideById('patientForm [id=age]');
hideById('patientForm [id=underAgeDiv]');
datePickerValid( 'patientForm [id=birthDate]' );
addEventForPatientForm('patientForm');
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-09-23 07:34:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-09-23 09:30:13 +0000
@@ -723,10 +723,12 @@
function showPatientDashboardForm( patientId )
{
+ hideById('selectDiv');
+ hideById('searchDiv');
hideById('listPatientDiv');
hideById('editPatientDiv');
- hideById('selectDiv');
- hideById('searchDiv');
+ hideById('listRelationshipDiv');
+ hideById('addRelationshipDiv');
hideById('migrationPatientDiv');
jQuery('#loaderDiv').show();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2012-09-22 12:23:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2012-09-23 09:30:13 +0000
@@ -7,7 +7,7 @@
#end
#end
-<tr>
+<tr id='registrationDateTR'>
<td class='text-column'><label for="registration_date">$i18n.getString( "registration_date" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td class="input-column" colspan='2'>
<input type="text" id="registrationDate" name="registrationDate" class="{validate:{required:true}}"/>
@@ -20,34 +20,39 @@
<tr>
<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
</tr>
+
<tr>
- <td class='text-column'><label for="fullName">$i18n.getString( "full_name" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td class="input-column">
- <input type="text" id="fullName" name="fullName" class="{validate:{required:true, rangelength:[3,50]}}"/>
- </td>
+ <td class='text-column'><label for="fullName">$i18n.getString( "full_name" )</label></td>
+ <td class="input-column"><input type="text" id="fullName" name="fullName" value="$!patient.getFullName()" class="{validate:{required:true, rangelength:[3,50]}}"></td>
</tr>
-
+
<tr>
- <td class='text-column'><label for="gender">$i18n.getString( "gender" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td class='text-column'><label for="gender">$i18n.getString( "gender" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td class="input-column">
<select id="gender" name="gender">
- <option value="M">$i18n.getString( "male" )</option>
- <option value="F" selected>$i18n.getString( "female" )</option>
- <option value="T">$i18n.getString( "transgender" )</option>
+ <option value="M" #if( $!patient.gender == 'M' ) selected="selected" #end>$i18n.getString( "male" )</option>
+ <option value="F" #if( $!patient.gender == 'F' ) selected="selected" #end>$i18n.getString( "female" )</option>
+ <option value="T" #if( $!patient.gender == 'T' ) selected="selected" #end>$i18n.getString( "transgender" )</option>
</select>
- </td>
+ </td>
</tr>
<tr>
- <td class='text-column'><label for="birthDate">$i18n.getString( "date_of_birth" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td class="input-column">
+ <td class='text-column' ><label for="birthDate">$i18n.getString( "date_of_birth" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td class="input-column">
<select id='dobType' name="dobType" style='width:120px' onchange='dobTypeOnChange("patientForm")' >
- <option value="V" selected>$i18n.getString( "verified" )</option>
- <option value="D" >$i18n.getString( "declared" )</option>
- <option value="A" >$i18n.getString( "approximated" )</option>
+ <option value="V" #if($patient.dobType=='V') selected #end >$i18n.getString( "verified" )</option>
+ <option value="D" #if($patient.dobType=='D') selected #end >$i18n.getString( "declared" )</option>
+ <option value="A" #if($patient.dobType=='A') selected #end >$i18n.getString( "approximated" )</option>
</select>
- <input type="text" id="age" name="age" placeholder="$i18n.getString('please_enter_age_in_year')" class="{validate:{number:true}}" style="width:136px;display:none;" />
- <input type="text" id="birthDate" name="birthDate" style='width:136px;' />
+ <input type="text" id="birthDate" name="birthDate" value='$!format.formatDate($!patient.birthDate)' style='width:136px;' />
+ <input type="text" id="age" name="age" placeholder="Enter age in years..." value='$!patient.getIntegerValueOfAge()' class="{validate:{number:true}}" style='width:136px;' />
+ </td>
+</tr>
+
+<tr>
+ <td></td>
+ <td class="input-column">
<input id="memberValidator" class="hidden {validate:{required:true}}"/>
</td>
</tr>
@@ -55,7 +60,7 @@
<tr>
<td class='text-column'><label for="phoneNumber">$i18n.getString( "phone_number" )</label></td>
<td class="input-column">
- <input type="text" id="phoneNumber" name="phoneNumber" />
+ <input type="text" id="phoneNumber" name="phoneNumber" value="$!patient.phoneNumber" />
</td>
</tr>
@@ -65,111 +70,140 @@
<select id="healthWorkerId" name="healthWorkerId">
<option value="">[$i18n.getString("please_select")]</option>
#foreach( $healthWorker in $healthWorkers)
- <option value="$healthWorker.id">$healthWorker.name</option>
+ <option value="$healthWorker.id" #if($patient.healthWorker.id == $healthWorker.id) selected #end>$healthWorker.name</option>
#end
</select>
</td>
</tr>
<!-- UNDERAGE -->
-<tr id='underAgeDiv'>
+
+<tr>
<td class='text-column'>$i18n.getString("has_guardian")</td>
<td>
- <input type="checkbox" name="underAge" id="underAge" onclick="toggleUnderAge(this);" value="true"/>
+ <input type="checkbox" name="underAge" id="underAge" onclick="toggleUnderAge(this);" value="true" #if($!patient.underAge == "true") checked="checked" #end/>
</td>
</tr>
+<!-- DEAD -->
+
<tr>
- <td></td>
- <td><input type="button" class='button' id='checkDuplicateBtn' name='checkDuplicateBtn' value="$i18n.getString('check_duplicate')" /></td>
-</tr>
-
-<!--IDENTIFIERS -->
+ <td class='text-column'>$i18n.getString("is_dead")</td>
+ <td>
+ <input type="checkbox" name="isDead" id="isDead" value="true" #if($!patient.isDead) checked="checked" #end onchange='isDeathOnChange();'/>
+ </td>
+</tr>
+
+<tr id='deathDateTR' #if($!patient.isDead) #else class="hidden" #end>
+ <td class='text-column'><label for="deathDate">$i18n.getString("death_date")</label></td>
+ <td class="input-column">
+ <input type="text" name="deathDate" id="deathDate" #if($!patient.deathDate) value="$format.formatDate( $!patient.deathDate )" #end>
+ </td>
+</tr>
+
+<tr><td> </td></tr>
+
+#if($!patient.underAge)
+ #set( $representative = $!patient.representative )
+ <tr>
+ <td class='text-column'>$i18n.getString("representative")</td>
+ <td>
+ $!patient.representative.getFullName() <img src="../images/information.png" alt="$i18n.getString( 'show_details' )" onclick='showRepresentativeInfo()' class='img-button'>
+ </td>
+ </tr>
+#end
+
#if( $identifierTypes.size() > 0)
- <tr><td colspan="2"> </td></tr>
- <tr><th colspan="2" class="heading-column">$i18n.getString( "patient_identifiers" )</th></tr>
+ <!--IDENTIFIERS -->
+ <tr><th colspan="2" class="heading-column">$i18n.getString("patient_identifiers")</th></tr>
#foreach ($identifierType in $identifierTypes)
- #if( $identifierType && $identifierType.program )
+ #if( $identifierType.program )
#else
- <tr>
- <td class='text-column'><label>$identifierType.name #if($identifierType.mandatory == true )<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
- <td class="input-column">
- <input type="text" id="iden$identifierType.id" name="iden$identifierType.id" data="{related:$identifierType.related}" class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" />
- </td>
- </tr>
+ #set( $identifier = '' )
+ #set( $identifier = $identiferMap.get( $identifierType.id ) )
+ <tr>
+ <td class='text-column'><label>$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
+ <td class="input-column"><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value="$!identifier" data="{related:$identifierType.related}" #if($identifierType.related && $!patient.underAge) disabled="disabled" #end class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" /></td>
+ </tr>
#end
#end
#end
<!-- ATTRIBUTES IN GROUPS -->
+
#foreach ($attributeGroup in $attributeGroupsMap.keySet() )
<tr><td> </td></tr>
<tr><th colspan="2" class="heading-column">$attributeGroup.name</th></tr>
#set($attributes = $attributeGroupsMap.get($attributeGroup))
#foreach($attribute in $attributes )
+ #set($value = "")
+ #set($value = $patientAttributeValueMap.get($attribute.id))
<tr>
<td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
<td class="input-column">
#if( $attribute.valueType == "YES/NO" )
- <select id="attr$attribute.id" name="attr$attribute.id">
+ <select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit">
<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
- <option value="true">$i18n.getString( "yes" )</option>
- <option value="false">$i18n.getString( "no" )</option>
+ <option value="true" #if($value=='true') selected #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if($value=='false') selected #end>$i18n.getString( "no" )</option>
</select>
#elseif( $attribute.valueType == "DATE" )
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default" $attribute.mandatory )'/>
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value='$value' class=' #validate( "default" $attribute.mandatory )'/>
<script type="text/javascript">
datePickerValid( 'attr$attribute.id' );
</script>
- #elseif( $attribute.valueType == "COMBO" )
- <select id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default" $attribute.mandatory )'>
+ #elseif( $attribute.valueType == "COMBO" )
+ <select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class='#validate( "default" $attribute.mandatory )'>
<option value="">[$i18n.getString( "please_select" )]</option>
#foreach ($option in $attribute.attributeOptions )
- <option value="$option.id" >$option.name</option>
+ <option value="$option.id" #if("$value"=="$option.name") selected #end>$option.name</option>
#end
</select>
#else
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required:$attribute.mandatory #if($attribute.valueType=='NUMBER'),number:true #end }}" />
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value='$value' class="{validate:{required:$attribute.mandatory #if($attribute.valueType=='NUMBER'),number:true #end }}" />
#end
</td>
</tr>
#end
#end
+<tr><td> </td></tr>
+
<!-- ATTRIBUTES NOT IN GROUPS -->
-<tr><td> </td></tr>
#if ( $noGroupAttributes && $noGroupAttributes.size() > 0)
- <tr><th colspan="2" class="heading-column">$i18n.getString( "other_details" )</th></tr>
+ <tr><th colspan="2" class="heading-column">$i18n.getString( "Other details" )</th></tr>
#foreach($attribute in $noGroupAttributes )
- #if( $!attribute && $attribute.program )
- #elseif( $!attribute)
+ #if( $!attribute && $attribute.program )
+ #elseif( $!attribute )
+ #set( $attributeValue = "" )
+ #set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) )
<tr>
- <td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
- <td class="input-column" >
+ <td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
+ <td class="input-column">
#if( $attribute.valueType == "YES/NO" )
- <select id="attr$attribute.id" name="attr$attribute.id" colspan='2' >
- <option value="" >[$i18n.getString( "please_select" )]</option>
- <option value="true">$i18n.getString( "yes" )</option>
- <option value="false" >$i18n.getString( "no" )</option>
+ <select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit">
+ <option value="">[$i18n.getString( "please_select" )]</option>
+ <option value="true" #if( $attributeValue ) selected="selected" #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if( !$attributeValue ) selected="selected" #end>$i18n.getString( "no" )</option>
</select>
#elseif( $attribute.valueType == "DATE" )
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default" $attribute.mandatory )' />
- <script type="text/javascript">
- datePickerValid( 'attr$attribute.id' );
- </script>
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value="$!attributeValue" class=' #validate( "default" $attribute.mandatory )'>
+ <script type="text/javascript">
+ datePickerValid( 'attr$attribute.id' );
+ </script>
#elseif( $attribute.valueType == "COMBO" )
- <select id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default" $attribute.mandatory )'>
- <option value="">[$i18n.getString( "please_select" )]</option>
- #foreach ($option in $attribute.attributeOptions )
- <option value="$option.id" >$option.name</option>
- #end
+ <select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class=' #validate( "default" $attribute.mandatory )' >
+ <option value="">[$i18n.getString( "please_select" )]</option>
+ #foreach ($option in $attribute.attributeOptions )
+ <option value="$option.id" #if($attributeValue == $option.name) selected="selected" #end>$option.name</option>
+ #end
</select>
- #else
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required:$attribute.mandatory #if($attribute.valueType=='NUMBER'),number:true #end }}" />
+ #else
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value="$!attributeValue" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" >
#end
</td>
</tr>
#end
#end
-#end
+#end
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-09-23 07:34:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-09-23 09:30:13 +0000
@@ -331,19 +331,19 @@
.stage-container
{
width:100%;
- height:70px;
+ height:100px;
}
.stage-flow
{
- height:70px;
+ height:100px;
overflow-x:hidden;
overflow-y:hidden;
}
.table-flow
{
- height:70px;
+ height:100px;
overflow-x:hidden;
overflow-y:hidden;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm 2012-09-22 09:44:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm 2012-09-23 09:30:13 +0000
@@ -9,7 +9,6 @@
#end
<script>
-
jQuery(document).ready( function(){
datePickerValid( 'patientForm [id=deathDate]' );
@@ -49,6 +48,7 @@
jQuery('#patientForm [id=age]').css("display","none");
}
});
+ hideById('registrationDateTR');
hideById('patientManagementLbl');
</script>
@@ -75,194 +75,8 @@
<td> </td>
</tr>
- <tr>
- <th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
- </tr>
-
- <tr>
- <td class='text-column'><label for="fullName">$i18n.getString( "full_name" )</label></td>
- <td class="input-column"><input type="text" id="fullName" name="fullName" value="$!patient.getFullName()" class="{validate:{required:true, rangelength:[3,50]}}"></td>
- </tr>
-
- <tr>
- <td class='text-column'><label for="gender">$i18n.getString( "gender" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td class="input-column">
- <select id="gender" name="gender">
- <option value="M" #if( $!patient.gender == 'M' ) selected="selected" #end>$i18n.getString( "male" )</option>
- <option value="F" #if( $!patient.gender == 'F' ) selected="selected" #end>$i18n.getString( "female" )</option>
- <option value="T" #if( $!patient.gender == 'T' ) selected="selected" #end>$i18n.getString( "transgender" )</option>
- </select>
- </td>
- </tr>
-
- <tr>
- <td class='text-column' ><label for="birthDate">$i18n.getString( "date_of_birth" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td class="input-column">
- <select id='dobType' name="dobType" style='width:120px' onchange='dobTypeOnChange("patientForm")' >
- <option value="V" #if($patient.dobType=='V') selected #end >$i18n.getString( "verified" )</option>
- <option value="D" #if($patient.dobType=='D') selected #end >$i18n.getString( "declared" )</option>
- <option value="A" #if($patient.dobType=='A') selected #end >$i18n.getString( "approximated" )</option>
- </select>
- <input type="text" id="birthDate" name="birthDate" value='$format.formatDate($!patient.birthDate)' style='width:136px;' />
- <input type="text" id="age" name="age" placeholder="Enter age in years..." value='$!patient.getIntegerValueOfAge()' class="{validate:{number:true}}" style='width:136px;' />
- </td>
- </tr>
-
- <tr>
- <td></td>
- <td class="input-column">
- <input id="memberValidator" class="hidden {validate:{required:true}}"/>
- </td>
- </tr>
-
- <tr>
- <td class='text-column'><label for="phoneNumber">$i18n.getString( "phone_number" )</label></td>
- <td class="input-column">
- <input type="text" id="phoneNumber" name="phoneNumber" value="$!patient.phoneNumber" />
- </td>
- </tr>
-
- <tr>
- <td class='text-column'><label for="healthWorker">$i18n.getString( "health_worker" )</label></td>
- <td class="input-column">
- <select id="healthWorkerId" name="healthWorkerId">
- <option value="">[$i18n.getString("please_select")]</option>
- #foreach( $healthWorker in $healthWorkers)
- <option value="$healthWorker.id" #if($patient.healthWorker.id == $healthWorker.id) selected #end>$healthWorker.name</option>
- #end
- </select>
- </td>
- </tr>
-
- <!-- UNDERAGE -->
-
- <tr>
- <td class='text-column'>$i18n.getString("has_guardian")</td>
- <td>
- <input type="checkbox" name="underAge" id="underAge" onclick="toggleUnderAge(this);" value="true" #if($!patient.underAge == "true") checked="checked" #end/>
- </td>
- </tr>
-
- <!-- DEAD -->
-
- <tr>
- <td class='text-column'>$i18n.getString("is_dead")</td>
- <td>
- <input type="checkbox" name="isDead" id="isDead" value="true" #if($!patient.isDead) checked="checked" #end onchange='isDeathOnChange();'/>
- </td>
- </tr>
-
- <tr id='deathDateTR' #if($!patient.isDead) #else class="hidden" #end>
- <td class='text-column'><label for="deathDate">$i18n.getString("death_date")</label></td>
- <td class="input-column">
- <input type="text" name="deathDate" id="deathDate" #if($!patient.deathDate) value="$format.formatDate( $!patient.deathDate )" #end>
- </td>
- </tr>
-
- <tr><td> </td></tr>
-
- #if($!patient.underAge)
- #set( $representative = $!patient.representative )
- <tr>
- <td class='text-column'>$i18n.getString("representative")</td>
- <td>
- $!patient.representative.getFullName() <img src="../images/information.png" alt="$i18n.getString( 'show_details' )" onclick='showRepresentativeInfo()' class='img-button'>
- </td>
- </tr>
- #end
-
- #if( $identifierTypes.size() > 0)
- <!--IDENTIFIERS -->
- <tr><th colspan="2" class="heading-column">$i18n.getString("patient_identifiers")</th></tr>
- #foreach ($identifierType in $identifierTypes)
- #if( $identifierType.program )
- #else
- #set( $identifier = '' )
- #set( $identifier = $identiferMap.get( $identifierType.id ) )
- <tr>
- <td class='text-column'><label>$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
- <td class="input-column"><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value="$!identifier" data="{related:$identifierType.related}" #if($identifierType.related && $!patient.underAge) disabled="disabled" #end class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" /></td>
- </tr>
- #end
- #end
- #end
-
- <!-- ATTRIBUTES IN GROUPS -->
-
- #foreach ($attributeGroup in $attributeGroupsMap.keySet() )
- <tr><td> </td></tr>
- <tr><th colspan="2" class="heading-column">$attributeGroup.name</th></tr>
- #set($attributes = $attributeGroupsMap.get($attributeGroup))
- #foreach($attribute in $attributes )
- <tr>
- <td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
- <td class="input-column">
- #if( $attribute.valueType == "YES/NO" )
- <select id="attr$attribute.id" name="attr$attribute.id">
- <option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
- <option value="true">$i18n.getString( "yes" )</option>
- <option value="false">$i18n.getString( "no" )</option>
- </select>
- #elseif( $attribute.valueType == "DATE" )
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default" $attribute.mandatory )'/>
- <script type="text/javascript">
- datePickerValid( 'attr$attribute.id' );
- </script>
- #elseif( $attribute.valueType == "COMBO" )
- <select id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default" $attribute.mandatory )'>
- <option value="">[$i18n.getString( "please_select" )]</option>
- #foreach ($option in $attribute.attributeOptions )
- <option value="$option.id" >$option.name</option>
- #end
- </select>
- #else
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required:$attribute.mandatory #if($attribute.valueType=='NUMBER'),number:true #end }}" />
- #end
- </td>
- </tr>
- #end
- #end
-
- <tr><td> </td></tr>
-
- <!-- ATTRIBUTES NOT IN GROUPS -->
-
- #if ( $noGroupAttributes && $noGroupAttributes.size() > 0)
- <tr><th colspan="2" class="heading-column">$i18n.getString( "Other details" )</th></tr>
- #foreach($attribute in $noGroupAttributes )
- #if( $!attribute && $attribute.program )
- #elseif( $!attribute )
- #set( $attributeValue = "" )
- #set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) )
- <tr>
- <td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
- <td class="input-column">
- #if( $attribute.valueType == "YES/NO" )
- <select id="attr$attribute.id" name="attr$attribute.id" >
- <option value="">[$i18n.getString( "please_select" )]</option>
- <option value="true" #if( $attributeValue ) selected="selected" #end>$i18n.getString( "yes" )</option>
- <option value="false" #if( !$attributeValue ) selected="selected" #end>$i18n.getString( "no" )</option>
- </select>
- #elseif( $attribute.valueType == "DATE" )
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" class=' #validate( "default" $attribute.mandatory )'>
- <script type="text/javascript">
- datePickerValid( 'attr$attribute.id' );
- </script>
- #elseif( $attribute.valueType == "COMBO" )
- <select id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default" $attribute.mandatory )' >
- <option value="">[$i18n.getString( "please_select" )]</option>
- #foreach ($option in $attribute.attributeOptions )
- <option value="$option.id" #if($attributeValue == $option.name) selected="selected" #end>$option.name</option>
- #end
- </select>
- #else
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" >
- #end
- </td>
- </tr>
- #end
- #end
- #end
+ #parse( "/dhis-web-caseentry/patientForm.vm" )
+
<tr>
<td></td>
<td>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm 2012-09-17 06:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm 2012-09-23 09:30:13 +0000
@@ -4,6 +4,7 @@
"name": "$!encoder.jsonEncode( ${patientAttribute.name} )",
"description": "$!encoder.jsonEncode( ${patientAttribute.description} )",
"mandatory": "$!{patientAttribute.mandatory}",
- "valueType": "$!encoder.jsonEncode( ${patientAttribute.valueType} )"
+ "valueType": "$!encoder.jsonEncode( ${patientAttribute.valueType} )",
+ "inherit": "$!encoder.jsonEncode( ${patientAttribute.inherit} )"
}
}
\ No newline at end of file
=== 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 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java 2012-09-23 09:30:13 +0000
@@ -100,6 +100,13 @@
this.attrOptions = attrOptions;
}
+ private Boolean inherit;
+
+ public void setInherit( Boolean inherit )
+ {
+ this.inherit = inherit;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -116,6 +123,9 @@
mandatory = (mandatory == null) ? false : true;
patientAttribute.setMandatory( mandatory );
+ inherit = (inherit == null) ? false : true;
+ patientAttribute.setInherit( inherit );
+
patientAttributeService.savePatientAttribute( patientAttribute );
if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) )
=== 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 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java 2012-09-23 09:30:13 +0000
@@ -121,12 +121,12 @@
{
this.attrOptions = attrOptions;
}
-
- private Integer programId;
-
- public void setProgramId( Integer programId )
+
+ private Boolean inherit;
+
+ public void setInherit( Boolean inherit )
{
- this.programId = programId;
+ this.inherit = inherit;
}
// -------------------------------------------------------------------------
@@ -141,10 +141,13 @@
patientAttribute.setName( name );
patientAttribute.setDescription( description );
patientAttribute.setValueType( valueType );
-
+
mandatory = (mandatory == null) ? false : true;
patientAttribute.setMandatory( mandatory );
+ inherit = (inherit == null) ? false : true;
+ patientAttribute.setInherit( inherit );
+
HttpServletRequest request = ServletActionContext.getRequest();
Collection<PatientAttributeOption> attributeOptions = patientAttributeOptionService.get( patientAttribute );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-09-18 08:31:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-09-23 09:30:13 +0000
@@ -295,4 +295,5 @@
reminder = Reminder
define_template_message = Define template message
remove_reminder = Remove reminder
-add_more = Add more ...
\ No newline at end of file
+add_more = Add more ...
+inherit = Inherit
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2012-09-23 09:30:13 +0000
@@ -28,6 +28,14 @@
</td>
<td></td>
</tr>
+
+ <tr>
+ <td><label for="inherit">$i18n.getString( "inherit" )</label></td>
+ <td>
+ <input type='checkbox' id="inherit" name="inherit" value='true'>
+ </td>
+ <td></td>
+ </tr>
<tr>
<td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js 2012-09-17 06:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js 2012-09-23 09:30:13 +0000
@@ -8,10 +8,10 @@
function ( json ) {
setInnerHTML( 'nameField', json.patientAttribute.name );
setInnerHTML( 'descriptionField', json.patientAttribute.description );
-
var mandatory = ( json.patientAttribute.mandatory == 'true') ? i18n_yes : i18n_no;
setInnerHTML( 'mandatoryField', mandatory );
-
+ var inherit = ( json.patientAttribute.inherit == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML( 'inheritField', inherit );
setInnerHTML( 'valueTypeField', json.patientAttribute.valueType );
showDetails();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm 2012-09-17 06:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm 2012-09-23 09:30:13 +0000
@@ -58,7 +58,8 @@
<p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
<p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
<p><label class="bold">$i18n.getString( "mandatory" ):</label><br><span id="mandatoryField"></span></p>
- <p><label class="bold">$i18n.getString( "value_type" ):</label><br><span id="valueTypeField"></span></p>
+ <p><label class="bold">$i18n.getString( "inherit" ):</label><br><span id="inheritField"></span></p>
+ <p><label class="bold">$i18n.getString( "value_type" ):</label><br><span id="valueTypeField"></span></p>
</div>
</td>
=== 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 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2012-09-23 09:30:13 +0000
@@ -32,6 +32,14 @@
<td></td>
</tr>
+ <tr>
+ <td><label for="inherit">$i18n.getString( "inherit" )</label></td>
+ <td>
+ <input type='checkbox' id="inherit" name="inherit" value='true' #if( $patientAttribute.inherit ) checked #end>
+ </td>
+ <td></td>
+ </tr>
+
<tr>
<td>$i18n.getString( "value_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
<td>