Search in sources :

Example 56 with Field

use of org.openmrs.module.registrationapp.model.Field in project openmrs-module-pihcore by PIH.

the class SectionsDefault method getMothersNameQuestion.

public Question getMothersNameQuestion() {
    Question q = new Question();
    q.setId("mothersFirstNameLabel");
    q.setLegend("zl.registration.patient.mothersFirstName.label");
    q.setHeader("zl.registration.patient.mothersFirstName.question");
    Field f = new Field();
    f.setFormFieldName("mothersFirstName");
    f.setType("personAttribute");
    f.setUuid(PihEmrConfigConstants.PERSONATTRIBUTETYPE_MOTHERS_FIRST_NAME_UUID);
    f.setWidget(getTextFieldWidget());
    if (config.getRegistrationConfig().getDemographics().getMothersName().getRequired()) {
        f.setCssClasses(Arrays.asList("required"));
    }
    q.addField(f);
    return q;
}
Also used : Field(org.openmrs.module.registrationapp.model.Field) Question(org.openmrs.module.registrationapp.model.Question)

Example 57 with Field

use of org.openmrs.module.registrationapp.model.Field in project openmrs-module-pihcore by PIH.

the class SectionsDefault method getTelephoneNumberQuestion.

public Question getTelephoneNumberQuestion() {
    Question q = new Question();
    q.setId("phoneNumberLabel");
    q.setLegend("registrationapp.patient.phone.label");
    q.setHeader("registrationapp.patient.phone.question");
    Field f = new Field();
    f.setFormFieldName("phoneNumber");
    f.setType("personAttribute");
    f.setUuid(Metadata.getPhoneNumberAttributeType().getUuid());
    ContactInfoConfigDescriptor contactInfoConfig = config.getRegistrationConfig().getContactInfo();
    if (contactInfoConfig != null && contactInfoConfig.getPhoneNumber() != null && StringUtils.isNotBlank(contactInfoConfig.getPhoneNumber().getRegex())) {
        f.setCssClasses(Arrays.asList("regex"));
        f.setWidget(getTextFieldWidget(null, contactInfoConfig.getPhoneNumber().getRegex()));
    } else {
        f.setWidget(getTextFieldWidget());
    }
    q.addField(f);
    return q;
}
Also used : Field(org.openmrs.module.registrationapp.model.Field) ContactInfoConfigDescriptor(org.openmrs.module.pihcore.config.registration.ContactInfoConfigDescriptor) Question(org.openmrs.module.registrationapp.model.Question)

Example 58 with Field

use of org.openmrs.module.registrationapp.model.Field in project openmrs-module-pihcore by PIH.

the class SectionsDefault method getContactPhoneNumber.

public Question getContactPhoneNumber() {
    Question q = new Question();
    q.setId("contactPhoneNumberQuestionLabel");
    q.setHeader("zl.registration.patient.contactPerson.phonenumber.question");
    q.setLegend("zl.registration.patient.contactPerson.phonenumber.label");
    {
        Field f = new Field();
        f.setFormFieldName("obsgroup.PIH:PATIENT CONTACTS CONSTRUCT.obs.PIH:TELEPHONE NUMBER OF CONTACT");
        f.setLabel("registrationapp.patient.phone.label");
        f.setType("obsgroup");
        ContactPersonConfigDescriptor contactPersonConfig = config.getRegistrationConfig().getContactPerson();
        if (contactPersonConfig != null && contactPersonConfig.getRequired() == true) {
            f.setCssClasses(Arrays.asList("required"));
        }
        if (contactPersonConfig != null && contactPersonConfig.getPhoneNumber() != null && StringUtils.isNotBlank(contactPersonConfig.getPhoneNumber().getRegex())) {
            f.setCssClasses(Arrays.asList("regex"));
            f.setWidget(getTextFieldWidget(30, contactPersonConfig.getPhoneNumber().getRegex()));
        } else {
            f.setWidget(getTextFieldWidget(30));
        }
        q.addField(f);
    }
    return q;
}
Also used : Field(org.openmrs.module.registrationapp.model.Field) ContactPersonConfigDescriptor(org.openmrs.module.pihcore.config.registration.ContactPersonConfigDescriptor) Question(org.openmrs.module.registrationapp.model.Question)

Example 59 with Field

use of org.openmrs.module.registrationapp.model.Field in project openmrs-module-pihcore by PIH.

the class SectionsPeru 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;
}
Also used : Field(org.openmrs.module.registrationapp.model.Field) HashMap(java.util.HashMap) Question(org.openmrs.module.registrationapp.model.Question) AddressHierarchyLevel(org.openmrs.module.addresshierarchy.AddressHierarchyLevel) AddressHierarchyService(org.openmrs.module.addresshierarchy.service.AddressHierarchyService)

Example 60 with Field

use of org.openmrs.module.registrationapp.model.Field in project openmrs-module-pihcore by PIH.

the class SectionsPeru method getTelephoneNumberQuestion.

public Question getTelephoneNumberQuestion() {
    Question q = new Question();
    q.setId("phoneNumberLabel");
    q.setLegend("registrationapp.patient.phone.label");
    q.setHeader("registrationapp.patient.phone.question");
    Field f = new Field();
    f.setFormFieldName("phoneNumber");
    f.setType("personAttribute");
    f.setUuid(Metadata.getPhoneNumberAttributeType().getUuid());
    ContactInfoConfigDescriptor contactInfoConfig = config.getRegistrationConfig().getContactInfo();
    if (contactInfoConfig != null && contactInfoConfig.getPhoneNumber() != null && StringUtils.isNotBlank(contactInfoConfig.getPhoneNumber().getRegex())) {
        f.setCssClasses(Arrays.asList("regex"));
        f.setWidget(getTextFieldWidget(null, contactInfoConfig.getPhoneNumber().getRegex()));
    } else {
        f.setWidget(getTextFieldWidget());
    }
    q.addField(f);
    return q;
}
Also used : Field(org.openmrs.module.registrationapp.model.Field) ContactInfoConfigDescriptor(org.openmrs.module.pihcore.config.registration.ContactInfoConfigDescriptor) Question(org.openmrs.module.registrationapp.model.Question)

Aggregations

Field (org.openmrs.module.registrationapp.model.Field)60 Question (org.openmrs.module.registrationapp.model.Question)60 AddressField (org.openmrs.module.addresshierarchy.AddressField)27 DropdownWidget (org.openmrs.module.registrationapp.model.DropdownWidget)16 HashMap (java.util.HashMap)9 AddressHierarchyLevel (org.openmrs.module.addresshierarchy.AddressHierarchyLevel)7 AddressHierarchyService (org.openmrs.module.addresshierarchy.service.AddressHierarchyService)7 ContactInfoConfigDescriptor (org.openmrs.module.pihcore.config.registration.ContactInfoConfigDescriptor)2 Section (org.openmrs.module.registrationapp.model.Section)2 ContactPersonConfigDescriptor (org.openmrs.module.pihcore.config.registration.ContactPersonConfigDescriptor)1