Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing add on module with test moh257enroll form #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified api/pom.xml
100644 → 100755
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions api/src/main/java/org/openmrs/module/keaddonexample/ExampleConstants.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ public class ExampleConstants {
public static final String APP_EXAMPLE = "keaddonexample.example";

public static final String EXAMPLE_ADDON_FORM_UUID = "b694b1bc-2086-47dd-a4ad-ba48f9471e4b";

public static final String ADHERENCE_FORM_UUID = "07197743-026a-4c7c-af60-42c166bf4acd";

//Encounter Type uuid
public static final String ADHERENCE_TYPE_UUID = "b586c79d-ab57-102d-be97-85aedb3d9f67";
}
Empty file modified api/src/main/resources/messages.properties
100644 → 100755
Empty file.
Empty file modified api/src/main/resources/metadata/Example_Metadata-1.zip
100644 → 100755
Empty file.
Binary file added api/src/main/resources/metadata/testForms2-1.zip
Binary file not shown.
47 changes: 36 additions & 11 deletions api/src/main/resources/moduleApplicationContext.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<!-- Metadata Package-->
<bean id="keaddonexample.config.metadata" class="org.openmrs.module.kenyacore.metadata.MetadataConfiguration">
<property name="moduleId" value="keaddonexample" />
<property name="packages">
<map>
<entry key="d3a71388-f624-4d30-8342-b6ff50df95c4" value="metadata/Example_Metadata-1.zip" />
<!-- Added by Erick -->
<entry key="a9acfcc4-f559-4fc2-b9b3-1c13fd9eb572" value="metadata/testForms2-1.zip" />
</map>
</property>
</bean>
Expand All @@ -29,30 +32,52 @@
<set>
<ref bean="kenyaemr.app.clinician" />
<ref bean="kenyaemr.app.chart" />
<ref bean="keaddonexample.app.example" />
</set>
</property>
<property name="icon" value="keaddonexample:forms/example.png" />
<property name="htmlform" value="keaddonexample:example.xml" />
<property name="htmlform" value="keaddonexample:htmlforms/example.xml" />
</bean>

<!-- Added by Erick -->

<bean id="keaddonexample.form.adherence" class="org.openmrs.module.kenyacore.form.FormDescriptor">
<property name="targetUuid" value="07197743-026a-4c7c-af60-42c166bf4acd" />
<property name="apps">
<set>
<ref bean="kenyaemr.app.clinician" />
<ref bean="kenyaemr.app.chart" />
<ref bean="keaddonexample.app.example" />
</set>
</property>
<property name="icon" value="keaddonexample:forms/example.png" />
<property name="htmlform" value="keaddonexample:htmlforms/adherence.xml" />
</bean>

<!-- To add form to the general visit form list -->

<!--<bean id="keaddonexample.config.form" class="org.openmrs.module.kenyacore.form.FormConfiguration">
<bean id="keaddonexample.config.form" class="org.openmrs.module.kenyacore.form.FormConfiguration">
<property name="generalVisitForms">
<list>
<ref bean="keaddonexample.form.example" />
<ref bean="keaddonexample.form.adherence" />
</list>
</property>
</bean>-->
</bean>

<!-- To add form to the HIV program visit form list -->

<bean parent="kenyaemr.program.hiv">
<property name="visitForms">
<list merge="true">
<ref local="keaddonexample.form.example" />
</list>
</property>
</bean>

<!--
<bean id="keaddonexample.config.form" class="org.openmrs.module.kenyacore.form.FormConfiguration">
<property name="programVisitForms">
<map>
<entry key-ref="kenyaemr.program.hiv">
<set><ref bean="keaddonexample.form.adherence" /></set>
<set><ref bean="keaddonexample.form.example" /></set>
</entry>
</map>
</property>
</bean>
-->

</beans>
Empty file modified omod/pom.xml
100644 → 100755
Empty file.
25 changes: 23 additions & 2 deletions omod/src/main/java/org/openmrs/module/keaddonexample/page/controller/HomePageController.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
import org.openmrs.module.keaddonexample.ExampleConstants;
import org.openmrs.module.kenyacore.metadata.MetadataUtils;
import org.openmrs.module.kenyaui.annotation.AppPage;
import org.openmrs.ui.framework.SimpleObject;
import org.openmrs.ui.framework.UiUtils;
import org.openmrs.ui.framework.page.PageModel;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collections;
import java.util.ArrayList;
import java.util.List;

/**
* Home page controller
Expand All @@ -38,7 +40,26 @@ public void controller(@RequestParam(required=false, value="patientId") Patient
model.addAttribute("patient", patient);

Form exampleForm = MetadataUtils.getForm(ExampleConstants.EXAMPLE_ADDON_FORM_UUID);
Form adherenceForm = MetadataUtils.getForm(ExampleConstants.ADHERENCE_FORM_UUID);

//model.addAttribute("forms", Collections.singletonList(ui.simplifyObject(exampleForm)));



List<SimpleObject> forms = new ArrayList<SimpleObject>();
forms.add(ui.simplifyObject(exampleForm));
forms.add(ui.simplifyObject(adherenceForm));

//List<SimpleObject> oneTimeForms = new ArrayList<SimpleObject>();

//List<FormDescriptor> oneTimeFormDescriptors = emr.getFormManager().getFormsForPatient(thisApp, patient);

//for (FormDescriptor formDescriptor : oneTimeFormDescriptors) {
// Form form = formDescriptor.getTarget();
// oneTimeForms.add(ui.simplifyObject(form));
// }
//model.addAttribute("oneTimeForms", oneTimeForms);
model.addAttribute("forms", forms);

model.addAttribute("forms", Collections.singletonList(ui.simplifyObject(exampleForm)));
}
}
Empty file modified omod/src/main/resources/config.xml
100644 → 100755
Empty file.
Empty file modified omod/src/main/resources/webModuleApplicationContext.xml
100644 → 100755
Empty file.
Empty file modified omod/src/main/webapp/pages/home.gsp
100644 → 100755
Empty file.
133 changes: 133 additions & 0 deletions omod/src/main/webapp/resources/htmlforms/adherence.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<htmlform>
<style type="text/css">
table.adhFm {
border-collapse: collapse;
//background-color: #F3F9FF;
}
table.adhFm > tbody > tr > td, table.adhFm > tbody > tr > th {
border: 1px solid black;
vertical-align: baseline;
padding: 4px;
text-align: left;
}
</style>
<fieldset>
<legend align="center">Adherence Form</legend>
<div class="encounter-details">
<table>
<tr>
<td>Date:</td>
<td><encounterDate id="encounter-date" default="now" showTime="true" /></td>
</tr>
<tr>
<td>Site:</td>
<td><encounterLocation default="GlobalProperty:kenyaemr.defaultLocation" type="autocomplete"/></td>
</tr>
</table>
</div>
<table class="adhFm">
<tbody>
<tr>
<td>Phone number:<obs conceptId="5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" /></td>
<td>Alternate Phone Number: {TBD-CIEL}</td>
</tr>
<tr>
<td colspan="2">What work do you do now to meet daily needs? (purpose: to determine if currently earning income or not)</td>
</tr>
<tr>
<td>[TBD-CIEL]-Current Work(Specify)</td>
<td>[TBD-CIEL]-Not Working Now</td>
</tr>

</tbody>
</table>
<fieldset>
<legend>Medications</legend>
<table class="adhFm">
<tr>
<td>Arv Regimen:<obs conceptId="966AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"/></td>
<td>Anti TB Medication:</td>
</tr>
<tr>
<td colspan="2">Other Medications</td>
</tr>
</table>

</fieldset>
<fieldset>
<legend>Adherence Buddy</legend>
<table>
<tr>
<td colspan="2">Do you currently have adherence buddy</td>

</tr>
<tr>
<td>Buddy's Fullname:<obs conceptId="160638AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"/> </td>
<td>Buddy's Relationship:<obs conceptId="160640AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"/> </td>
</tr>
<tr>
<td>Buddy's Phone Number:<obs conceptId="160642AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"/> </td>
<td>or:</td>
</tr>
</table>

</fieldset>
<fieldset>
<legend>Adherence Dates</legend>
<table class="adhFM">
<tr>
<th>Adherence Counselling Dates (dd/mm/yyy)</th>
<th>Time Preferred for Taking Pills</th>
</tr>
<tr>
<td>
1st Session: <br/>
2nd Session: <br/>
3rd Session: <br/>
Booster Session: <br/>
</td>
<td>AM:---- PM----<br/>
Reminders of Time<br/>

</td>
</tr>
<tr>
<td>Buddy's Phone Number:</td>
<td>or:</td>
</tr>
</table>

</fieldset>
<fieldset>
<legend>Disclosure</legend>
<table>
<tr>
<td>Have you disclosed your HIV Status to any of the following?</td>
</tr>

</table>
</fieldset>
<fieldset>
<legend>Observation Infor</legend>
<table>
<tr>
<td>Weight:</td>
<td><obs conceptId="5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" /></td>
</tr>
<tr>
<td>Height:</td>
<td><obs conceptId="5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" /></td>
</tr>
</table>
</fieldset>
</fieldset>
<table>
<tr>
<td>Form Filled by:</td>
<td><encounterProvider /></td>
</tr>
</table>
<div class="ke-form-buttons">
<submit />
</div>
</htmlform>
Empty file modified omod/src/main/webapp/resources/htmlforms/example.xml
100644 → 100755
Empty file.
Loading