Skip to content

Commit

Permalink
EMTCT Module Integration forms (#326)
Browse files Browse the repository at this point in the history
* Added follow--up encounter type

* Updated modules to match Reference Application 2.7 release

* Added custom concepts for EMTCT module

* First draft of the follow-up form

* Updated concept IDs to start from 165100

* Merge branch 'master' of https://github.com/METS-Programme/openmrs-module-aijar into emtct_module

# Conflicts:
#	api/src/main/resources/metadata/Concepts_ART-1.xml

* Concept name definitions

* Updated ordering of concept to match the existing style

* Added validations for the data capture form

* Updated pom.xml for html form entry update to 3.6.0 which fixes a javascript issue
  • Loading branch information
ssmusoke authored and slubwama committed Feb 2, 2018
1 parent 402288d commit af4463d
Show file tree
Hide file tree
Showing 7 changed files with 369 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void install() throws Exception {
install(EncounterTypes.OPD_ENCOUNTER);
install(EncounterTypes.TB_SUMMARY_ENCOUNTER);
install(EncounterTypes.VIRAL_LOAD_NON_SUPPRESSED);
install(EncounterTypes.APPOINTMENT_FOLLOW_UP);

//installing programs metadata
log.info("Installing Programs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,20 @@ public String uuid() {
return "38cb2232-30fc-4b1f-8df1-47c795771ee9";
}
};

public static EncounterTypeDescriptor APPOINTMENT_FOLLOW_UP = new EncounterTypeDescriptor() {
@Override
public String name() {
return "Appointment Follow-up ";
}

@Override
public String description() {
return "Followup actions for patients especially after missing a facility visit";
}

public String uuid() {
return "dc551efc-024d-4c40-aeb8-2147c4033778";
}
};
}
104 changes: 104 additions & 0 deletions api/src/main/resources/metadata/Custom_Concepts.xml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions omod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
<artifactId>htmlformentry-api-1.10</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>htmlformentry-api-2.0</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>htmlformentry-api-2.0</artifactId>
Expand Down
231 changes: 231 additions & 0 deletions omod/src/main/webapp/resources/htmlforms/053-AppointmentBook.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
<htmlform formName="HMIS 053 Appointment Followup"
formDescription="Followup for the appoinment"
formEncounterType="dc551efc-024d-4c40-aeb8-2147c4033778"
formUuid="2641baf2-fcc7-4aeb-ad3c-51a02ec7e556"
formVersion="1.0"
formAddMetadata="yes"
formUILocation="patientDashboard.visitActions"
formOrder="10"
formIcon="icon-user"
formShowIf="(visit.active || !visit.active) &amp;&amp; patient.person.dead==false"
formDisplayStyle="Standard"
formLabel="Appointment Followup">
<style type="text/css">
form#htmlform div.ai-page-frame table>tbody tr:nth-child(odd) td {
background: #eeeeee;
}

form#htmlform div.ai-page-frame table>tbody tr:nth-child(even) td {
background: #f9f9f9;
}

form#htmlform div.ai-page-frame fieldset#baby-information table {
margin: 0 0 5px 0;
}
</style>

<script>
jq(document).ready(function() {
<ifMode mode="ENTER">
disableContainer('#outcomeContainer');
<!-- disableContainer('#nextstepsContainer'); -->
</ifMode>
<!-- enable SMS Message outcomes -->
jq('#sms-message').click(function(){
if (getValue('sms-message.value')) {
fieldHelper.enable(getField('sms-not-delivered.value'));
fieldHelper.enable(getField('sms-received.value'));
fieldHelper.enable(getField('client-visit-rescheduled.value'));
fieldHelper.enable(getField('new-visit-date.value'));
fieldHelper.enable(getField('outcome-other.value'));
enableContainer('#nextstepsContainer');
} else {
fieldHelper.disable(getField('sms-not-delivered.value'));
fieldHelper.disable(getField('sms-received.value'));
}
});

<!-- enable Phone call outcomes -->
jq('#phone-call').click(function(){
if (getValue('phone-call.value')) {
fieldHelper.enable(getField('phone-off.value'));
fieldHelper.enable(getField('phone-not-answered.value'));
fieldHelper.enable(getField('spoke-with-patient.value'));
fieldHelper.enable(getField('spoke-with-someone-else.value'));
fieldHelper.enable(getField('client-visit-rescheduled.value'));
fieldHelper.enable(getField('new-visit-date.value'));
fieldHelper.enable(getField('outcome-other.value'));
enableContainer('#nextstepsContainer');
} else {
fieldHelper.disable(getField('phone-off.value'));
fieldHelper.disable(getField('phone-not-answered.value'));
fieldHelper.disable(getField('spoke-with-patient.value'));
fieldHelper.disable(getField('spoke-with-someone-else.value'));
}
});

<!-- enable home visit outcomes -->
jq('#home-visit').click(function(){
if (getValue('home-visit.value')) {
fieldHelper.enable(getField('spoke-with-patient.value'));
fieldHelper.enable(getField('spoke-with-someone-else.value'));
fieldHelper.enable(getField('client-visit-rescheduled.value'));
fieldHelper.enable(getField('new-visit-date.value'));
fieldHelper.enable(getField('outcome-other.value'));
enableContainer('#nextstepsContainer');
} else {
fieldHelper.disable(getField('phone-off.value'));
fieldHelper.disable(getField('phone-not-answered.value'));
fieldHelper.disable(getField('spoke-with-patient.value'));
fieldHelper.disable(getField('spoke-with-someone-else.value'));
}
});

<!-- additional validations -->
beforeSubmit.push(function() {
<!-- clear the error fields -->
setValue('new-visit-date.error', '');
setValue('new-followup-date.error', '');
setValue('home-visit-date.error', '');
<!-- New visit date must be after today -->
var new_visit_date = new Date(changeFieldDateToJavascriptDate(getValue('new-visit-date.value')));
var new_followup_date = new Date(changeFieldDateToJavascriptDate(getValue('new-followup-date.value')));
var home_visit_date = new Date(changeFieldDateToJavascriptDate(getValue('home-visit-date.value')));
var encounterDate = new Date(changeFieldDateToJavascriptDate(getValue('encounterDate.value')));

<!-- if the visit was rescheduled then the new visit date has to be provided -->
if (getValue('client-visit-rescheduled.value')) {
if (getValue('new-visit-date.value') == '') {
getField('new-visit-date.error').html('The date when the client visit has been rescheduled to has to be provided').show();
return false;
} else {
if (new_visit_date &lt;= encounterDate) {
getField('new-visit-date.error').html('The date when the client visit has been rescheduled has to be after ' + changeFieldDateToJavascriptDate(getValue('encounterDate.value'))).show();
return false;
}
}
}
<!-- if the next step is to a follow up again then a new followup date has to be provided -->
if (getValue('try-followup-again.value')) {
if (getValue('new-followup-date.value') == '') {
getField('new-followup-date.error').html('The date of the next follow up has to be provided').show();
return false;
} else {
if (new_followup_date &lt;= encounterDate) {
getField('new-followup-date.error').html('The date of the next follow up has to be after ' + changeFieldDateToJavascriptDate(getValue('encounterDate.value'))).show();
return false;
}
}
}
<!-- if the visit was rescheduled then the new visit date has to be provided -->
if (getValue('home-visit-on.value')) {
if (getValue('home-visit-date.value') == '') {
getField('home-visit-date.error').html('The date of the home visit has to be provided ').show();
return false;
} else {
if (home_visit_date &lt;= encounterDate) {
getField('home-visit-date.error').html('The date of the home visit has to be after ' + changeFieldDateToJavascriptDate(getValue('encounterDate.value'))).show();
return false;
}
}
}
});
});
</script>

<div class="ai-page-frame">
<div class="headers" style="text-align: center;">
<h3 style="background: #000000; padding: 10px;color:#07c1ae">HMIS 053 Appointment Book - Followup</h3>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<p>
<label>Followup Date</label>
</p>
</td>
<td>
<encounterDate default="today" disallowMultipleEncountersOnDate="block"/>
<span style="display: none;">
<encounterLocation default="629d78e9-93e5-43b0-ad8a-48313fd99117"
order="629d78e9-93e5-43b0-ad8a-48313fd99117"/>
</span>
</td>
</tr>
<tr>
<td>
<p>
<label>Type of Care</label>
</p>
</td>
<td>
<!-- TODO: Add a validation to ensure that a user does not click Pre-ART and ART at the same time -->
<obs id="pre-art" conceptId="160530" answerConceptId="160525" answerLabel="Pre ART" class="horizontal-layout-options"/><br/>
<obs id="art" conceptId="160530" answerConceptId="160524" answerLabel="ART" class="horizontal-layout-options"/><br/>
<includeIf velocityTest="$patient.age &gt; 5">
<obs id="exposed-infant" conceptId="160530" answerConceptId="160526" answerLabel="HIV Exposed Infant" class="horizontal-layout-options"/><br/>
</includeIf>
<includeIf velocityTest="$patient.gender == 'F'">
<obs id="anc" conceptId="160530" answerConceptId="160446" answerLabel="Antenatal Clinic (ANC)" class="horizontal-layout-options"/><br/>
</includeIf>
<obs id="tb" conceptId="160530" answerConceptId="160529" answerLabel="Tuberculosis (TB)" class="horizontal-layout-options"/>
</td>
</tr>
<tr>
<td>
<p>
<label>Followup Type</label>

</p>
</td>
<td>
<p id="followupTypeContainer">
<obs id="sms-message" conceptId="165100" answerConceptId="165101" answerLabel="SMS Message" class="horizontal-layout-options"/><br/>
<obs id="phone-call" conceptId="165100" answerConceptId="165102" answerLabel="Phone Call" class="horizontal-layout-options"/><br/>
<obs id="home-visit" conceptId="165100" answerConceptId="165103" answerLabel="Home Visit" class="horizontal-layout-options"/><br/><br/>
<obs id="followup-type-other" conceptId="165100" answerConceptId="5622" answerLabel="Other Specify:" commentFieldLabel="" class="horizontal-layout-options"/>
</p>
</td>
</tr>
<tr>
<td>
<p>
<label>Outcome</label>


</p>
</td>
<td>
<p id="outcomeContainer">
<obs id="sms-not-delivered" conceptId="165104" answerConceptId="165105" answerLabel="SMS Message Not Delivered" class="horizontal-layout-options"/><br/>
<obs id="sms-received" conceptId="165104" answerConceptId="165106" answerLabel="SMS Message Received" class="horizontal-layout-options"/><br/>
<obs id="client-visit-rescheduled" conceptId="165104" answerConceptId="165107" answerLabel="Client Visit Rescheduled to " class="horizontal-layout-options"/><obs id="new-visit-date" conceptId="165108" allowFutureDates="true"/>
<obs id="phone-off" conceptId="165104" answerConceptId="165109" answerLabel="Telephone off" class="horizontal-layout-options"/><br/>
<obs id="phone-not-answered" conceptId="165104" answerConceptId="165110" answerLabel="Telephone not answered" class="horizontal-layout-options"/><br/>
<obs id="spoke-with-patient" conceptId="165104" answerConceptId="165111" answerLabel="Spoke with patient" class="horizontal-layout-options"/><br/>
<obs id="spoke-with-someone-else" conceptId="165104" answerConceptId="165112" answerLabel="Spoke with someone else" class="horizontal-layout-options"/><br/><br/>
<obs id="outcome-other" conceptId="165100" answerConceptId="5622" answerLabel="Other Specify:" commentFieldLabel="" class="horizontal-layout-options"/>
</p>
</td>
</tr>
<tr>
<td>
<p>
<label>Next Step</label>

</p>
</td>
<td>
<p id="nextstepsContainer">
<obs id="call-treatmentsupporter" conceptId="165113" answerConceptId="165114" answerLabel="Call Treatment Supporter" class="horizontal-layout-options"/><br/>
<obs id="try-followup-again" conceptId="165113" answerConceptId="165115" answerLabel="Try to followup patient again on " class="horizontal-layout-options"/><obs id="new-followup-date" conceptId="165116" allowFutureDates="true"/>
<obs id="home-visit-on" conceptId="165113" answerConceptId="165103" answerLabel="Home visit on" class="horizontal-layout-options" toggle="{id: 'new-followup-date', style: 'dim'}"/><obs id="home-visit-date" conceptId="165117" allowFutureDates="true"/>
</p>
</td>
</tr>
</table>
<section>
<submit/>
</section>
</div>
</htmlform>
9 changes: 4 additions & 5 deletions omod/src/main/webapp/resources/js/aijar.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ jq(document).ready(function () {
});

/**
* Changes a field date in the format yy-mm-dd to dd/mm/yy which eas
* Changes a field date in the format yy-mm-dd to dd/mm/yy which is easier to read
* @param dateValue
*/
function changeFieldDateToJavascriptDate(dateValue) {
new Date();
return new Date(dateValue);
return jq.datepicker.formatDate('dd/mm/yy', jq.datepicker.parseDate('yy-mm-dd', dateValue));
}


Expand Down Expand Up @@ -222,7 +221,7 @@ var fieldHelper = {
this.$jqObj = jq(args);
}

this.$jqObj.attr('disabled', true);
this.$jqObj.attr('disabled', true).fadeTo(250, 0.25);

},
enable: function (args) {
Expand All @@ -232,7 +231,7 @@ var fieldHelper = {
this.$jqObj = jq(args);
}

this.$jqObj.removeAttr('disabled');
this.$jqObj.removeAttr('disabled').fadeTo(250, 1);
},
makeReadonly: function (args) {
if (args instanceof jQuery) {
Expand Down
18 changes: 8 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@
<formentryappVersion>1.4.2</formentryappVersion>
<formfilterVersion>1.0.0</formfilterVersion>
<htmlformentryuiVersion>1.6.4</htmlformentryuiVersion>
<htmlformentryVersion>3.3.2</htmlformentryVersion>
<htmlformentryuiVersion>1.6.3</htmlformentryuiVersion>
<htmlformentryVersion>3.6.0</htmlformentryVersion>
<htmlwidgetsVersion>1.9.0</htmlwidgetsVersion>
<idgenVersion>4.4.0</idgenVersion>
Expand Down Expand Up @@ -124,7 +122,7 @@
<scope>compile</scope>
</dependency>
-->

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
Expand Down Expand Up @@ -221,7 +219,7 @@
<version>${dataexchangeVersion}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>dataintegrity-api</artifactId>
Expand Down Expand Up @@ -265,7 +263,7 @@
<version>${htmlformentryVersion}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>htmlformentry-api-1.10</artifactId>
Expand All @@ -286,7 +284,7 @@
<version>${idgenVersion}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>legacyui-omod</artifactId>
Expand Down Expand Up @@ -342,7 +340,7 @@
<version>${registrationcoreVersion}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>registrationapp-api</artifactId>
Expand All @@ -363,7 +361,7 @@
<version>${reportingVersion}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>reportingcompatibility-api</artifactId>
Expand All @@ -377,7 +375,7 @@
<version>${serializationxstreamVersion}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>serialization.xstream-api-2.0</artifactId>
Expand Down Expand Up @@ -565,4 +563,4 @@
</pluginRepository>
</pluginRepositories>

</project>
</project>

0 comments on commit af4463d

Please sign in to comment.