Package org.openmrs

Examples of org.openmrs.PatientIdentifierType


      createWidgets(context, birthDateWidget, birthDateErrorWidget, existingPatient != null ? existingPatient.getBirthdate() : null);

    }
    else if (FIELD_IDENTIFIER.equalsIgnoreCase(field)) {

      PatientIdentifierType idType = HtmlFormEntryUtil.getPatientIdentifierType(attributes.get("identifierTypeId"));
     
      identifierTypeValueWidget = new TextFieldWidget();
      identifierTypeValueErrorWidget = new ErrorWidget();
      String initialValue = null;
      if (existingPatient != null) {
        if (idType == null) {
          if (existingPatient.getPatientIdentifier() != null) {
            initialValue = existingPatient.getPatientIdentifier().getIdentifier();
          }
        } else {
          if (existingPatient.getPatientIdentifier(idType) != null) {
            initialValue = existingPatient.getPatientIdentifier(idType).getIdentifier();
          }
        }
      }
      createWidgets(context, identifierTypeValueWidget, identifierTypeValueErrorWidget, initialValue);

      if (idType != null) {
        identifierTypeWidget = new HiddenFieldWidget();
        createWidgets(context, identifierTypeWidget, null, idType.getId().toString());
      }
      else {
        identifierTypeWidget = new DropdownWidget();
        List<PatientIdentifierType> patientIdentifierTypes = HtmlFormEntryUtil.getPatientIdentifierTypes();
View Full Code Here


      }
    }
    if (identifierTypeValueWidget != null && identifierTypeWidget != null) {
      String identifier = (String) identifierTypeValueWidget.getValue(context, request);
      PatientIdentifierType identifierType = getIdentifierType((String) identifierTypeWidget.getValue(context, request));

      // Look for an existing identifier of this type
      PatientIdentifier patientIdentifier = patient.getPatientIdentifier(identifierType);

      if (StringUtils.hasText(identifier)) {
        // No existing identifier of this type, so create new
        if (patientIdentifier == null) {
          patientIdentifier = new PatientIdentifier();
          patientIdentifier.setIdentifierType(identifierType);

          // HACK: we need to set the date created  and uuid here as a hack around a hibernate flushing issue (see saving the Patient in FormEntrySession applyActions())
          patientIdentifier.setDateChanged(new Date());
          patientIdentifier.setUuid(UUID.randomUUID().toString());

          // For 1.9+ onwards patients require a preferred identifier
          if (patient.getPatientId() == null) {
            patientIdentifier.setPreferred(true);
          }

          patient.addIdentifier(patientIdentifier);
        }

        if (!identifier.equals(patientIdentifier.getIdentifier()) || !identifierType.equals(patientIdentifier.getIdentifierType())) {
          validateIdentifier(identifierType.getId(), identifier);
        }

        patientIdentifier.setIdentifier(identifier);
      }
      else if (patientIdentifier != null) {
View Full Code Here

      }
    }
  }

  private PatientIdentifierType getIdentifierType(String id) {
    PatientIdentifierType patientIdentifierType = Context.getPatientService().getPatientIdentifierType(new Integer(id));
    if (patientIdentifierType == null) {
      throw new RuntimeException("Invalid identifierTypeId given " + id);
    }
    return patientIdentifierType;
  }
View Full Code Here

        htmlform.setXmlData(new TestUtil().loadXmlFromFile(XML_DATASET_PATH + "returnSectionsAndConceptsInSectionsTestFormWithGroups.xml"));
        List<String> extraCols = new ArrayList<String>();
        extraCols.add("valueModifier");
        extraCols.add("accessionNumber");
        extraCols.add("comment");
        PatientIdentifierType pit = Context.getPatientService().getPatientIdentifierType(2);
        String ret = HtmlFormEntryExportUtil.generateColumnHeadersFromHtmlForm(htmlform, extraCols, new StringBuffer(""), Collections.singletonList(pit));
        //System.out.println("TESTHEADER " + ret);
       
        Assert.assertTrue(ret.contains("\"ENCOUNTER_ID\""));
        Assert.assertTrue(ret.contains("\"ENCOUNTER_DATE\""));
View Full Code Here

        htmlform.setXmlData(new TestUtil().loadXmlFromFile(XML_DATASET_PATH + "obsGroupDataExportTest.xml"));
        List<String> extraCols = new ArrayList<String>();
        extraCols.add("valueModifier");
        extraCols.add("accessionNumber");
        extraCols.add("comment");
        PatientIdentifierType pit = Context.getPatientService().getPatientIdentifierType(2);
        String header = HtmlFormEntryExportUtil.generateColumnHeadersFromHtmlForm(htmlform, extraCols, new StringBuffer(""), Collections.singletonList(pit));
        //Build a couple of encounters for the form
        List<Encounter> encounters = new ArrayList<Encounter>();
       
       
View Full Code Here

        htmlform.setXmlData(new TestUtil().loadXmlFromFile(XML_DATASET_PATH + "obsGroupDataExportTest.xml"));
        List<String> extraCols = new ArrayList<String>();
        extraCols.add("valueModifier");
        extraCols.add("accessionNumber");
        extraCols.add("comment");
        PatientIdentifierType pit = Context.getPatientService().getPatientIdentifierType(2);
        PatientIdentifierType pitTwo = Context.getPatientService().getPatientIdentifierType(1);
        List<PatientIdentifierType> pitList = new ArrayList<PatientIdentifierType>();
        pitList.add(pit);
        pitList.add(pitTwo);
        //Build a couple of encounters for the form
        List<Encounter> encounters = new ArrayList<Encounter>();
View Full Code Here

        htmlform.setXmlData(new TestUtil().loadXmlFromFile(XML_DATASET_PATH + "datatypeRenderingTest.xml"));
        List<String> extraCols = new ArrayList<String>();
        extraCols.add("valueModifier");
        extraCols.add("accessionNumber");
        extraCols.add("comment");
        PatientIdentifierType pit = Context.getPatientService().getPatientIdentifierType(2);
        PatientIdentifierType pitTwo = Context.getPatientService().getPatientIdentifierType(1);
        List<PatientIdentifierType> pitList = new ArrayList<PatientIdentifierType>();
        pitList.add(pit);
        pitList.add(pitTwo);
        //Build a couple of encounters for the form
        List<Encounter> encounters = new ArrayList<Encounter>();
View Full Code Here

    Assert.assertFalse(formClone.getXmlData().contains(existingDrugName));
   
    Assert.assertTrue(formClone.getXmlData().contains(incomingRoleName));
    Assert.assertFalse(formClone.getXmlData().contains(existingRoleName));
   
    PatientIdentifierType incoming1 = Context.getPatientService().getPatientIdentifierType(2)// Old Identifier Type
    PatientIdentifierType existing1 = Context.getPatientService().getPatientIdentifierType(4); // Social Security Number
   
    Location incoming2 = Context.getLocationService().getLocation(3)// Never Never Land
    Location existing2 = Context.getLocationService().getLocation(2); // Xanadu
   
    Drug incoming3 = Context.getConceptService().getDrug(3)// Aspirin
View Full Code Here

   * @should find an identifier type by its uuid
   * @should find an identifier type by its name
   * @should return null otherwise
   */
  public static PatientIdentifierType getPatientIdentifierType(String id) {
    PatientIdentifierType identifierType = null;
   
    if (id != null) {

            id = id.trim();

View Full Code Here

TOP

Related Classes of org.openmrs.PatientIdentifierType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.