use of org.openmrs.module.addresshierarchy.AddressHierarchyLevel in project openmrs-module-pihcore by PIH.
the class SectionsHaiti method getBirthplaceQuestion.
@Override
public Question getBirthplaceQuestion() {
Question q = new Question();
q.setId("birthplaceLabel");
q.setHeader("zl.registration.patient.birthplace.question");
q.setLegend("zl.registration.patient.birthplace.label");
Field f = new Field();
// f.setFormFieldName("obsgroup.PIH:PATIENT CONTACTS CONSTRUCT.obs.PIH:ADDRESS OF PATIENT CONTACT");
f.setLabel("zl.registration.patient.birthplace.label");
f.setType("personAddress");
// If there are address hierarchy levels configured, use the address hierarchy widget, otherwise use the standard address widget
List<AddressHierarchyLevel> levels = Context.getService(AddressHierarchyService.class).getAddressHierarchyLevels();
if (levels != null && levels.size() > 0) {
// q.setDisplayTemplate(getAddressHierarchyDisplayTemplate(levels));
f.setWidget(getAddressHierarchyWidget(levels, getPlaceOfBirthAddressFieldMappings(), true));
} else {
Map<String, String> m = new HashMap<String, String>();
m.put("providerName", "uicommons");
m.put("fragmentId", "field/personAddress");
f.setWidget(toObjectNode(m));
}
q.addField(f);
return q;
}
use of org.openmrs.module.addresshierarchy.AddressHierarchyLevel in project openmrs-module-mirebalais by PIH.
the class PatientRegistrationApp method getContactAddress.
public Question getContactAddress(Config config, boolean required) {
Question q = new Question();
q.setId("contactQuestionLabel");
q.setHeader("zl.registration.patient.contactPerson.address.question");
q.setLegend("zl.registration.patient.contactPerson.address.label");
if (config.getCountry().equals(ConfigDescriptor.Country.HAITI)) {
Field f = new Field();
// f.setFormFieldName("obsgroup.PIH:PATIENT CONTACTS CONSTRUCT.obs.PIH:ADDRESS OF PATIENT CONTACT");
f.setLabel("zl.registration.patient.contactPerson.address.label");
f.setType("personAddress");
// If there are address hierarchy levels configured, use the address hierarchy widget, otherwise use the standard address widget
List<AddressHierarchyLevel> levels = Context.getService(AddressHierarchyService.class).getAddressHierarchyLevels();
if (levels != null && levels.size() > 0) {
// q.setDisplayTemplate(getAddressHierarchyDisplayTemplate(levels));
f.setWidget(getAddressHierarchyWidget(levels, getContactAddressFieldMappings(config), true));
} else {
Map<String, String> m = new HashMap<String, String>();
m.put("providerName", "uicommons");
m.put("fragmentId", "field/personAddress");
f.setWidget(toObjectNode(m));
if (required) {
f.setCssClasses(Arrays.asList("required"));
}
}
q.addField(f);
} else {
Field f = new Field();
f.setFormFieldName("obsgroup.PIH:PATIENT CONTACTS CONSTRUCT.obs.PIH:ADDRESS OF PATIENT CONTACT");
f.setLabel("zl.registration.patient.contactPerson.address.label");
f.setType("obsgroup");
f.setWidget(getTextAreaWidget(250));
if (required) {
f.setCssClasses(Arrays.asList("required"));
}
q.addField(f);
}
return q;
}
use of org.openmrs.module.addresshierarchy.AddressHierarchyLevel in project openmrs-module-mirebalais by PIH.
the class WristbandTemplateTest method setupAddressHierarchyLevels.
private void setupAddressHierarchyLevels() {
AddressHierarchyLevel country = new AddressHierarchyLevel();
country.setAddressField(AddressField.COUNTRY);
AddressHierarchyLevel state = new AddressHierarchyLevel();
state.setAddressField(AddressField.STATE_PROVINCE);
state.setParent(country);
AddressHierarchyLevel city = new AddressHierarchyLevel();
city.setAddressField(AddressField.CITY_VILLAGE);
city.setParent(state);
AddressHierarchyLevel address3 = new AddressHierarchyLevel();
address3.setAddressField(AddressField.ADDRESS_3);
address3.setParent(city);
AddressHierarchyLevel address1 = new AddressHierarchyLevel();
address1.setAddressField(AddressField.ADDRESS_1);
address1.setParent(address3);
AddressHierarchyLevel address2 = new AddressHierarchyLevel();
address2.setAddressField(AddressField.ADDRESS_2);
address2.setParent(address1);
when(addressHierarchyService.getBottomAddressHierarchyLevel()).thenReturn(address2);
when(addressHierarchyService.getAddressHierarchyLevelsCount()).thenReturn(6);
}
use of org.openmrs.module.addresshierarchy.AddressHierarchyLevel in project openmrs-module-pihcore by PIH.
the class SectionsHaiti method getContactAddress.
@Override
public Question getContactAddress() {
Question q = new Question();
q.setId("contactQuestionLabel");
q.setHeader("zl.registration.patient.contactPerson.address.question");
q.setLegend("zl.registration.patient.contactPerson.address.label");
Field f = new Field();
// f.setFormFieldName("obsgroup.PIH:PATIENT CONTACTS CONSTRUCT.obs.PIH:ADDRESS OF PATIENT CONTACT");
f.setLabel("zl.registration.patient.contactPerson.address.label");
f.setType("personAddress");
// If there are address hierarchy levels configured, use the address hierarchy widget, otherwise use the standard address widget
List<AddressHierarchyLevel> levels = Context.getService(AddressHierarchyService.class).getAddressHierarchyLevels();
if (levels != null && levels.size() > 0) {
// q.setDisplayTemplate(getAddressHierarchyDisplayTemplate(levels));
f.setWidget(getAddressHierarchyWidget(levels, getContactAddressFieldMappings(), true));
} else {
Map<String, String> m = new HashMap<String, String>();
m.put("providerName", "uicommons");
m.put("fragmentId", "field/personAddress");
f.setWidget(toObjectNode(m));
if (config.getRegistrationConfig().getContactPerson() != null && config.getRegistrationConfig().getContactPerson().getRequired() == true) {
f.setCssClasses(Arrays.asList("required"));
}
}
q.addField(f);
return q;
}
use of org.openmrs.module.addresshierarchy.AddressHierarchyLevel in project openmrs-module-pihcore by PIH.
the class SectionsDefault method getAddressQuestion.
public Question getAddressQuestion() {
Question q = new Question();
q.setId("personAddressQuestion");
q.setLegend("registrationapp.patient.address");
q.setHeader("registrationapp.patient.address.question");
Field f = new Field();
f.setType("personAddress");
// If there are address hierarchy levels configured, use the address hierarchy widget, otherwise use the standard address widget
List<AddressHierarchyLevel> levels = Context.getService(AddressHierarchyService.class).getAddressHierarchyLevels();
if (levels != null && levels.size() > 0) {
q.setDisplayTemplate(getAddressHierarchyDisplayTemplate(levels));
f.setWidget(getAddressHierarchyWidget(levels, null, true));
} else {
Map<String, String> m = new HashMap<String, String>();
m.put("providerName", "uicommons");
m.put("fragmentId", "field/personAddress");
f.setWidget(toObjectNode(m));
}
q.addField(f);
return q;
}
Aggregations