dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06333
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1996: commited mp state customisation for identifier
------------------------------------------------------------
revno: 1996
committer: Namrata
branch nick: trunk
timestamp: Wed 2010-06-16 17:46:35 +0530
message:
commited mp state customisation for identifier
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddPatientFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.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/addPatientForm.vm
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/updatePatientForm.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-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java 2010-04-19 09:54:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java 2010-06-16 12:16:35 +0000
@@ -198,8 +198,15 @@
{
for ( PatientIdentifierType identifierType : identifierTypes )
{
- value = request.getParameter( PREFIX_IDENTIFIER + identifierType.getId() );
-
+ if(identifierType.getFormat().equals("State Format"))
+ {
+ value = organisationUnit.getCode()+request.getParameter( "progcode" )+request.getParameter( "yearcode" )+request.getParameter( "benicode" );
+ System.out.println( "value = "+value );
+ }
+ else
+ {
+ value = request.getParameter( PREFIX_IDENTIFIER + identifierType.getId() );
+ }
if ( StringUtils.isNotBlank( value ) )
{
pIdentifier = new PatientIdentifier();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java 2010-04-05 12:33:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java 2010-06-16 12:16:35 +0000
@@ -100,6 +100,14 @@
private String systemIdentifier;
+ private String benicode;
+
+ private String yearcode;
+
+ private String progcode;
+
+ private String orgunitcode;
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -126,6 +134,7 @@
if( representativeIdentifier.getIdentifierType() != null && representativeIdentifier.getIdentifierType().isRelated() )
{
identiferMap.put( representativeIdentifier.getIdentifierType().getId(), representativeIdentifier.getIdentifier() );
+ //System.out.println( "if patient uderage "+representativeIdentifier.getIdentifierType().getId()+ representativeIdentifier.getIdentifier() );
}
}
}
@@ -136,6 +145,15 @@
if ( idType != null )
{
identiferMap.put( identifier.getIdentifierType().getId(), identifier.getIdentifier() );
+ //System.out.println( "if type is not null "+identifier.getIdentifierType().getId()+ identifier.getIdentifier() );
+ if(idType.getFormat().equals("State Format"))
+ {
+ String iden = identifier.getIdentifier();
+ benicode = iden.substring( 12,16 );//abcdefghi1121111
+ yearcode = iden.substring( 10, 12 );
+ progcode = iden.substring( 9, 10 );
+ orgunitcode = iden.substring( 0, 9);
+ }
}
else
systemIdentifier = identifier.getIdentifier();
@@ -269,4 +287,24 @@
{
return systemIdentifier;
}
+
+ public String getBenicode() {
+ return benicode;
+ }
+
+ public String getOrgunitcode()
+ {
+ return orgunitcode;
+ }
+
+ public String getProgcode()
+ {
+ return progcode;
+ }
+
+ public String getYearcode()
+ {
+ return yearcode;
+ }
+
}
\ 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/patient/ShowAddPatientFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddPatientFormAction.java 2010-04-05 12:33:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddPatientFormAction.java 2010-06-16 12:16:35 +0000
@@ -39,6 +39,10 @@
import org.hisp.dhis.patient.PatientIdentifierTypeService;
import com.opensymphony.xwork2.Action;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
/**
* @author Abyot Asalefew Gizaw
@@ -95,6 +99,12 @@
private Collection<PatientAttributeGroup> attributeGroups;
private Collection<PatientIdentifierType> identifierTypes;
+
+ private OrganisationUnit organisationUnit;
+
+ private String year;
+
+ private boolean showMsg;
// -------------------------------------------------------------------------
// Action implementation
@@ -102,13 +112,29 @@
public String execute()
{
-
+
+ showMsg = false;
identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes();
noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup();
attributeGroups = patientAttributeGroupService.getAllPatientAttributeGroups();
+ organisationUnit = selectionManager.getSelectedOrganisationUnit();
+
+ for(PatientIdentifierType identifierType :identifierTypes)
+ {
+ if(identifierType.getFormat().equals("State Format") && identifierType.isMandatory()==true )
+ {
+ if(organisationUnit.getCode()==null || organisationUnit.getCode().length() < 9)
+ showMsg = true;
+ }
+ }
+ //System.out.println( "ou = "+organisationUnit.getCode() + organisationUnit.getName());
+
+ Calendar cal = Calendar.getInstance();
+ SimpleDateFormat dataFormat = new SimpleDateFormat("y");
+ year = dataFormat.format(new Date());
return SUCCESS;
}
@@ -129,4 +155,17 @@
{
return noGroupAttributes;
}
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+ public boolean isShowMsg() {
+ return showMsg;
+ }
+
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java 2010-04-05 12:33:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java 2010-06-16 12:16:35 +0000
@@ -181,7 +181,16 @@
{
for ( PatientIdentifierType identifierType : identifierTypes )
{
- value = request.getParameter( AddPatientAction.PREFIX_IDENTIFIER + identifierType.getId() );
+ if(identifierType.getFormat().equals("State Format"))
+ {
+ value = request.getParameter( "orgunitcode" )+request.getParameter( "progcode" )+request.getParameter( "yearcode" )+request.getParameter( "benicode" );
+ //System.out.println( "value = "+value );
+ }
+ else
+ {
+ value = request.getParameter( AddPatientAction.PREFIX_IDENTIFIER + identifierType.getId() );
+ }
+ //value = request.getParameter( AddPatientAction.PREFIX_IDENTIFIER + identifierType.getId() );
if ( StringUtils.isNotBlank( value ) )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java 2010-04-19 09:54:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java 2010-06-16 12:16:35 +0000
@@ -279,6 +279,19 @@
for ( PatientIdentifierType idType : identifiers )
{
// If underAge is TRUE : Only check duplicate on PatientIdentifierType which related is FALSE
+ /*if(idType.getFormat().equals("State Format"))
+ {
+ String orgUnitCodeValue = request.getParameter( "orgunitcode" );
+ if(orgUnitCodeValue!=null)
+ {
+ System.out.println("orgUnitCodeValue = "+orgUnitCodeValue );
+ if(orgUnitCodeValue.length()<9)
+ {
+ message = i18n.getString( "oucode_must_be_valid" );
+ return INPUT;
+ }
+ }
+ }*/
if( !underAge || ( underAge && !idType.isRelated() ) )
{
value = request.getParameter( AddPatientAction.PREFIX_IDENTIFIER + idType.getId() );
=== 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 2010-06-09 19:41:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2010-06-16 12:16:35 +0000
@@ -380,4 +380,5 @@
total_result = Total number of results
no_of_pages = No. of pages
size_of_page = Size of page
-jump_to_page = Jump to page
\ No newline at end of file
+jump_to_page = Jump to page
+oucode_must_be_valid = Please set valid 9 digit organisation unit code to add new patient
\ 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/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm 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/addPatientForm.vm 2010-06-16 12:16:35 +0000
@@ -12,6 +12,10 @@
{validate:{required:true}}
#end
#end
+
+#if($showMsg == "true" )
+ <table><tr><td>$i18n.getString( "oucode_must_be_valid" )</td></tr><table>
+#else
<script>
//-----------------------------------------------------------------------
//init jQuery validation for addPatientForm
@@ -37,8 +41,11 @@
<form id="addPatientForm" action="addPatient.action" method="post">
<input type="hidden" id="representativeId" name="representativeId"/>
<input type="hidden" id="relationshipTypeId" name="relationshipTypeId"/>
-<table>
- <tr><td> </td></tr>
+<table>
+
+ <tr><td> </td></tr>
+
+
<tr>
<th colspan="2">$i18n.getString( "name" )<em title="$i18n.getString( "required" )" class="required">*</em></th>
</tr>
@@ -79,8 +86,8 @@
<input type="text" id="age" name="age" style="width:4em" onchange="ageOnchange()" class="{validate:{number:true}}">
<label for="estimated">$i18n.getString( "estimated" )</label>
- <input type="checkbox" id="birthDateEstimated" name="birthDateEstimated" value="true">
- </td>
+ <input type="checkbox" id="birthDateEstimated" name="birthDateEstimated" value="true">
+ </td>
<td></td>
</tr>
<tr>
@@ -118,7 +125,21 @@
#foreach ($identifierType in $identifierTypes)
<tr>
<td><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" data="{related:$identifierType.related}" class='idfield #validate( "default" $identifierType.mandatory ) '/></td>
+
+ #if($identifierType.format == "State Format")
+ <td style="padding-left:1.1em"><input type="hidden" id="iden$identifierType.id" name="iden$identifierType.id"/>
+ #if($organisationUnit.code == "null")
+ #set($organisationUnit.code = "" );
+ #end
+ <input type="text" id="orgunitcode" name="orgunitcode" disabled="disabled" value="$organisationUnit.code" maxlength="9" size="10"/>
+ -<input type="text" id="progcode" name="progcode" maxlength="1" size="1" class='idfield #validate( "default" $identifierType.mandatory ) '/>
+ -<input type="text" id="yearcode" name="yearcode" maxlength="2" size="2" value="$year" class="{validate:{required:true,minlength:2}}"/>
+ -<input type="text" id="benicode" name="benicode" maxlength="4" size="4" class="{validate:{required:true,minlength:4}}"/>
+ </td>
+ #else
+ <td class="input-column"><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" data="{related:$identifierType.related}" class='idfield #validate( "default" $identifierType.mandatory ) '/></td>
+ #end
+
</tr>
#end
@@ -133,13 +154,14 @@
<td class="input-column">
#if( $attribute.valueType == "YES/NO" )
<select id="attr$attribute.id" name="attr$attribute.id" style="width:100%" >
- <option value="">[$i18n.getString( "please_select" )]</option>
+ <option value="">[$i18n.getString( "please_select" )]</option>
<option value="true">$i18n.getString( "yes" )</option>
<option value="false" selected="selected">$i18n.getString( "no" )</option>
</select>
#elseif( $attribute.valueType == "DATE" )
<img src="../images/calendar_icon.gif" width="16" height="16" id="getDateValue$attribute.id" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''" alt="$i18n.getString( "date" )">
<input type="text" id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default" $attribute.mandatory )'>
+
<script type="text/javascript">
Calendar.setup({
inputField : "attr$attribute.id", // id of the input field
@@ -173,7 +195,7 @@
<td class="input-column">
#if( $attribute.valueType == "YES/NO" )
<select id="attr$attribute.id" name="attr$attribute.id" style="width:100%" >
- <option value="" >[$i18n.getString( "please_select" )]</option>
+ <option value="" >[$i18n.getString( "please_select" )]</option>
<option value="true">$i18n.getString( "yes" )</option>
<option value="false" >$i18n.getString( "no" )</option>
</select>
@@ -207,7 +229,8 @@
<input type="submit" value="$i18n.getString( "add" )" style="width:10em">
<input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='patient.action'" style="width:10em">
</p>
-</form>
+</form>
+#end
<span id="message"></span>
@@ -247,4 +270,5 @@
var i18n_patient_system_id = '$encoder.jsEscape( $i18n.getString( "patient_system_id" ) , "'")';
var i18n_child_representative = '$encoder.jsEscape( $i18n.getString( "child_representative" ) , "'")';
var checkedDuplicate = false;
+ var i18n_oucode_must_have_9_digits = '$encoder.jsEscape( $i18n.getString( "oucode_must_be_valid" ) , "'")';
</script>
\ 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/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-05-17 02:59:28 +0000
+++ 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
@@ -262,7 +262,14 @@
}
}
+// -----------------------------------------------------------------------------
+// Disable form
+// -----------------------------------------------------------------------------
+function disableForm()
+{
+ $('#firstName').attr("disabled", true);
+}
// -----------------------------------------------------------------------------
// Add Patient
// -----------------------------------------------------------------------------
@@ -271,7 +278,7 @@
{
var age = document.getElementById( 'age' );
-
+ var orgunitcode = document.getElementById('orgunitcode');
if( age.value != '' )
{
if( !isInt( age.value ) )
@@ -282,7 +289,7 @@
return false;
}
- }
+ }
var params = '&checkedDuplicate='+checkedDuplicate
+'&firstName=' + getFieldValue( 'firstName' )
@@ -418,7 +425,7 @@
var fromList = document.getElementById(listId);
- if ( fromList.selectedIndex == -1 ) { return; }
+ if ( fromList.selectedIndex == -1 ) {return;}
if ( ! availableList )
{
@@ -570,7 +577,7 @@
}
jQuery("#thickboxContainer","#hiddenModalContent").html("").append(sPatient);
if( !validate ) jQuery("#btnCreateNew","#hiddenModalContent").click(function(){window.parent.tb_remove();});
- else jQuery("#btnCreateNew","#hiddenModalContent").click(function(){window.parent.tb_remove();window.parent.checkedDuplicate = true; window.parent.validatePatient();});
+ else jQuery("#btnCreateNew","#hiddenModalContent").click(function(){window.parent.tb_remove();window.parent.checkedDuplicate = true;window.parent.validatePatient();});
tb_show( message, "#TB_inline?height=500&width=500&inlineId=hiddenModalContent", null);
}
}
=== 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-04-05 12:33:38 +0000
+++ 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
@@ -120,8 +120,14 @@
#set( $identifier = "" )
#set( $identifier = $identiferMap.get( $identifierType.id ) )
<tr>
- <td><label for="bloodGroup">$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
- <td><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( "default" $identifierType.mandatory )' style="width:30em" /></td>
+ <td><label for="bloodGroup">$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
+ #if($identifierType.format == "State Format")
+ <td><input type="hidden" id="iden$identifierType.id" name="iden$identifierType.id" value="$identifier"/>
+ <input type="text" id="orgunitcode" name="orgunitcode" disabled="disabled" value="$orgunitcode" maxlength="9" size="10"/>-<input type="text" id="progcode" name="progcode" value="$progcode" maxlength="1" size="1"/>-<input type="text" id="yearcode" value="$yearcode" name="yearcode" maxlength="2" size="2"/>-<input type="text" id="benicode" name="benicode" value="$benicode" maxlength="4" size="4"/></td>
+ #else
+ <td><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( "default" $identifierType.mandatory )' style="width:30em" /></td>
+ #end
+
</tr>
#end
<tr><td> </td></tr>