Пример #1
0
  private String buildUserRequest(ECommerceUpdate oneUpdate) {
    StringBuffer requestBuf = new StringBuffer();
    String timeNow = getTimeStampString();
    String username = oneUpdate.getUsername();
    String actionDate = oneUpdate.getActionDate();

    MemberDBBean dbBean = new MemberDBBean(getClass().getName());
    Long user_id = new Long(0);
    Long practice_id = new Long(0);
    Member member = new Member();
    Vector dates = new Vector();
    String practice_username = "";
    try {
      user_id = dbBean.getDrWebId(username);
      practice_id = dbBean.getPracticeId(user_id);
      practice_username = dbBean.getUsername(practice_id);
      member = dbBean.retrieveURSMember(user_id, practice_id);
      dates = dbBean.retrieveRxDates(user_id);
    } catch (Exception e) {
      e.printStackTrace();
    }

    System.out.println("username=========" + username);
    System.out.println("user_id=========" + user_id);
    System.out.println("practice_id=========" + practice_id);
    System.out.println("practice_username=========" + practice_username);

    if (practice_id == 0) throw new IllegalArgumentException("No practice is associated.");

    if (user_id > 0 && practice_id > 0 && member.getMemberID() > 0) {
      requestBuf.append("service=Rcopia&action=updateUser");
      requestBuf.append("&time=");
      requestBuf.append(timeNow);

      requestBuf.append("&practice_username="******"&user_username="******"&drwebid=");
      requestBuf.append(member.getMemberID());
      requestBuf.append("&firstName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getFirstName())));
      requestBuf.append("&lastName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getLastName())));
      requestBuf.append("&middleInitial=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getMiddleName())));
      requestBuf.append("&suffix=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getSuffix())));
      requestBuf.append("&memberType=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getMemberType())));
      requestBuf.append("&status=");
      String aflag = StringFunctions.objectToString(member.getActiveFlag());
      String rflag = StringFunctions.objectToString(member.getEPS());
      if (aflag.equals("A")) {
        if (rflag.equals("D") || rflag.equals("X") || rflag.equals("V") || rflag.equals("I"))
          aflag = rflag;
        else if (rflag.equals("R") || rflag.equals("NM")) aflag = "I";
      } else if (!aflag.equals("A")
          && !aflag.equals("I")
          && !aflag.equals("D")
          && !aflag.equals("X")) aflag = "O";

      requestBuf.append(StringFunctions.urlEncoded(aflag));
      Vector disableInfo = new Vector();
      if (aflag.equals("D")) {
        try {
          disableInfo = dbBean.getLastDisabledInformation(new Long(user_id));
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      requestBuf.append("&disabled_by=");
      if (disableInfo != null && !disableInfo.isEmpty()) {
        requestBuf.append(StringFunctions.objectToString(disableInfo.elementAt(1)));
      }
      requestBuf.append("&disabled_reason=");
      if (disableInfo != null && !disableInfo.isEmpty()) {
        requestBuf.append(StringFunctions.objectToString(disableInfo.elementAt(2)));
      }
      requestBuf.append("&disable_date=");
      if (disableInfo != null && !disableInfo.isEmpty()) {
        requestBuf.append(StringFunctions.objectToString(disableInfo.elementAt(4)));
      }

      requestBuf.append("&isTest=");
      if (member.getIsTest() != null && !member.getIsTest().equals(""))
        requestBuf.append(
            StringFunctions.urlEncoded(StringFunctions.objectToString(member.getIsTest())));
      else requestBuf.append("n");

      requestBuf.append("&isProvider=");

      String m = member.getMemberType();
      if (m != null && !m.equals("M") && !m.equals("NP") && !m.equals("PA") && !m.equals("D"))
        requestBuf.append("n");
      else requestBuf.append("y");

      requestBuf.append("&dea=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getDEA())));
      requestBuf.append("&spec1_desc=");
      if (member.getPrimarySpecialty() != null)
        requestBuf.append(
            StringFunctions.urlEncoded(
                StringFunctions.objectToString(member.getPrimarySpecialty())));
      requestBuf.append("&practice_drwebid=");
      requestBuf.append(practice_id);

      Vector groups = member.getGroups();
      String groupIds = "";
      String groupNames = "";
      if (groups != null && !groups.isEmpty()) {
        int s = groups.size();
        for (int y = 0; y < s; y++) {
          PracticeGroup pg = (PracticeGroup) groups.elementAt(y);
          groupIds += pg.getGroupID();
          groupNames += pg.getGroupName();
          if (y > 0) {
            groupIds += "|";
            groupNames += "|";
          }
        }
      }

      requestBuf.append("&groupID=");
      requestBuf.append(groupIds);
      requestBuf.append("&groupName=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(groupNames)));
      requestBuf.append("&officeName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getOfficeName())));
      requestBuf.append("&address1=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryAddress1())));
      requestBuf.append("&address2=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryAddress2())));
      requestBuf.append("&city=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryCity())));
      requestBuf.append("&state=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryState())));
      requestBuf.append("&zip=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryZip())));
      requestBuf.append("&phoneNumber=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryPhone())));
      requestBuf.append("&faxNumber=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryFax())));
      requestBuf.append("&email=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getEmail())));

      Vector affils = member.getAffiliations();

      String sponsor = "";
      String sales = "";
      String acct_manager = "";
      String deploy_manager = "";
      String ipa = "";

      if (affils != null && !affils.isEmpty()) {
        int si = affils.size();
        for (int t = 0; t < si; t++) {
          UserAffiliation ua = (UserAffiliation) affils.elementAt(t);
          if (ua.getAffiliationType().equals("SP")) sponsor = ua.getAffiliationName();
          else if (ua.getAffiliationType().equals("SA")) sales = ua.getAffiliationName();
          if (ua.getAffiliationType().equals("AM")) acct_manager = ua.getAffiliationName();
          if (ua.getAffiliationType().equals("DM")) deploy_manager = ua.getAffiliationName();
          if (ua.getAffiliationType().equals("IPA")) ipa = ua.getAffiliationName();
        }
      }

      requestBuf.append("&ipa=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(ipa)));
      requestBuf.append("&sponsor=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(sponsor)));
      requestBuf.append("&salesrep=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(sales)));
      requestBuf.append("&accountManager=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(acct_manager)));
      requestBuf.append("&deploymentManager=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(deploy_manager)));

      if (dates != null && !dates.isEmpty()) {
        Vector d = (Vector) dates.elementAt(0);
        requestBuf.append("&rx1Date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(0)));
        requestBuf.append("&rx5Date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(1)));
        requestBuf.append("&rx50Date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(2)));
        requestBuf.append("&rx200Date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(3)));
        requestBuf.append("&last_script_date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(4)));
        requestBuf.append("&last_pda_activity_date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(5)));
        requestBuf.append("&total_scripts=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(6)));
        requestBuf.append("&last_login_date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(7)));

      } else {
        requestBuf.append("&rx1Date=");
        requestBuf.append("&rx5Date=");
        requestBuf.append("&rx50Date=");
        requestBuf.append("&rx200Date=");
        requestBuf.append("&last_script_date=");
        requestBuf.append("&last_pda_activity_date=");
        requestBuf.append("&total_scripts=");
        requestBuf.append("&last_login_date=");
      }
    }

    return requestBuf.toString();
  }
Пример #2
0
  public static String generateFormContent(
      HttpServletRequest request,
      HttpServletResponse response,
      String form_type,
      String provider_last_name,
      String provider_first_name,
      String drwebid,
      String state) {

    // String strTitle = "Rcopia Provider Registration";
    String strImage1 = m_DrFirstLogoPath; // "D:\\newweb\\webapps\\dfdev\\img\\drFirstLogoBlue.gif";
    String strSigBox =
        m_AppPath + "urs_temp/img/sigBox.gif"; // "D:\\newweb\\webapps\\dfdev\\img\\sigBox.gif";

    // String strHeader="Rcopia Provider Registration";

    String strCompany = "DrFirst";

    String strFax = m_Fax; // "(240) 331-9195";
    String strPhone = m_DrFirstPhone; // "(888) 271-9898 x4";
    String strRcopia = "Rcopia";
    // String strstrPartner =
    // StringFunctions.objectToString(request.getParameter("strPartner"));
    System.out.println(
        "####################### SignatureFormGenerator.generateFormContent()  state = " + state);
    String strSignatureExplaination = UserConstants.getSignatureExplaintion(state);
    String strDAWStatement = UserConstants.getDAWStatement(state);
    String strDAWSign = UserConstants.getDAWSign(state);

    String practiceName =
        (String) request.getSession().getAttribute(urs.valueobject.UserConstants.PRACTICE_NAME);
    String practiceId =
        (String) request.getSession().getAttribute(urs.valueobject.UserConstants.PRACTICE_ID);
    String private_label_loaded =
        (String)
            request
                .getSession()
                .getAttribute(urs.valueobject.UserConstants.PRIVATE_LABEL_LOADED + practiceId);
    PrivateLabel private_label = null;
    // Added by Channpreet for Task OR31-004 starts
    StringBuffer providerAgentsName = new StringBuffer();
    String currentUser =
        (String) request.getSession().getAttribute(UserConstants.CURRENT_USER_NAME);
    MemberDBBean dbBean = new MemberDBBean();
    String practice_username = dbBean.getUsername(Long.parseLong(practiceId));
    // Added by Channpreet for Task OR31-004 ends

    System.out.println(
        "#################### in SignatureFormGenerator  private_label_loaded = "
            + private_label_loaded);
    System.out.println(
        "#################### in SignatureFormGenerator  practiceId = " + practiceId);
    if (private_label_loaded == null) {
      UserValidationBean uBean = new UserValidationBean();
      private_label = uBean.getPrivateLabelByPracticeID(Long.parseLong(practiceId));
      request
          .getSession()
          .setAttribute(urs.valueobject.UserConstants.PRIVATE_LABEL_LOADED + practiceId, "y");
      if (private_label != null)
        request
            .getSession()
            .setAttribute(urs.valueobject.UserConstants.PRIVATE_LABEL + practiceId, private_label);
    } else {
      private_label =
          (PrivateLabel)
              request
                  .getSession()
                  .getAttribute(urs.valueobject.UserConstants.PRIVATE_LABEL + practiceId);
    }
    System.out.println(
        "#################### in SignatureFormGenerator  private_label = " + private_label);
    if (private_label != null) {
      strCompany = private_label.getCompanyName();
      strPhone = private_label.getContactPhone();
      strRcopia = private_label.getApplicationName();
      strImage1 = m_AppPath + private_label.getLogoUrl();
    }
    System.out.println(
        "#################### in SignatureFormGenerator  strCompany = " + strCompany);
    System.out.println("#################### in SignatureFormGenerator  strPhone = " + strPhone);
    System.out.println("#################### in SignatureFormGenerator  strRcopia = " + strRcopia);
    System.out.println("#################### in SignatureFormGenerator  strImage1 = " + strImage1);
    String sigFormBuf = UserConstants.getSignatureForm();
    String provAgentFormBuf = UserConstants.getProviderAgentForm();
    String dawBuff = UserConstants.getDawForm();

    StringBuffer mFormBuff = new StringBuffer();
    String outBuff = "";

    if (practiceName == null) {
      practiceName = "unknown";
    }
    try {
      if (!form_type.equals("PAT")) mFormBuff = new StringBuffer(sigFormBuf);
      else mFormBuff = new StringBuffer(provAgentFormBuf);

      String outBuff2 = "";
      String form_id = "F01-";
      System.out.println("*********************form_type: " + form_type);
      System.out.println(
          "*********************strDAWStatement.length():" + strDAWStatement.length());
      if (!form_type.equals("PAT") && strDAWStatement.length() > 0) {

        outBuff2 = StringFunctions.replace(dawBuff, "$strDAWStatement", strDAWStatement);
        outBuff2 = StringFunctions.replace(outBuff2.toString(), "$strDAWSign", strDAWSign);
        form_id = "F02-";
      } else if (form_type.equals("PAT")) {
        // Added by Channpreet for Task OR31-004 starts
        List providerAgentsList =
            (List) request.getSession().getAttribute("urs_provider_agent_print_list");
        if (providerAgentsList != null) {
          int size = providerAgentsList.size();
          for (int x = 0; x < size; x++) {
            List rv = (List) providerAgentsList.get(x);
            String firstName = StringFunctions.objectToString(rv.get(2));
            String lastName = StringFunctions.objectToString(rv.get(1));
            String name = firstName + " " + lastName;
            // providerAgentsName.append("<input type=\"radio\" name=\"providerAgents\"
            // value=\""+name+"\" />"+name+"<br> \n");
            providerAgentsName.append("&nbsp;&nbsp;" + name + "<br> \n");
          }
        }
        // Added by Channpreet for Task OR31-004 ends

        form_id = "A01-";
      }
      Linear linear = new Linear();
      String barcode_value = form_id;
      if (!state.equals("")) barcode_value += state + "-";
      barcode_value += SERVER_PREFIX + "-" + drwebid;
      System.out.println("barcodevalue===" + barcode_value);
      linear.setData(barcode_value);
      System.out.println("setData===" + barcode_value);
      linear.setType(Linear.CODE39);
      linear.setAddCheckSum(true);
      // X - 2; Y -90; BarcodeWidth 650
      linear.setY(75);
      linear.setX(2);
      linear.setBarcodeWidth(750);
      String barcodeimage = "barcodes/barcode-" + drwebid + ".gif";
      System.out.println("renderBarcode ===");
      linear.renderBarcode(m_AppPath + "urs_temp/barcodes/barcode-" + drwebid + ".gif");
      System.out.println("renderBarcode === done");

      // outBuff = StringFunctions.replace(mFormBuff.toString(),
      // "$strTitle", strTitle);

      outBuff =
          StringFunctions.replace(
              mFormBuff.toString(), "$strSignatureExplaination", strSignatureExplaination);
      outBuff = StringFunctions.replace(outBuff, "$SignDAW", outBuff2);
      outBuff = StringFunctions.replace(outBuff, "$practiceId", practiceId);
      outBuff = StringFunctions.replace(outBuff, "$practiceName", practiceName);
      outBuff = StringFunctions.replace(outBuff, "$drWebId", drwebid);
      outBuff = StringFunctions.replace(outBuff, "$providerLast", provider_last_name);
      outBuff = StringFunctions.replace(outBuff, "$providerFirst", provider_first_name);
      outBuff = StringFunctions.replace(outBuff, "$strImage1", strImage1);
      // outBuff = StringFunctions.replace(outBuff, "$strHeader",
      // strHeader);
      outBuff = StringFunctions.replace(outBuff, "$strCompany", strCompany);
      outBuff = StringFunctions.replace(outBuff, "$strFax", strFax);
      outBuff = StringFunctions.replace(outBuff, "$strPhone", strPhone);
      outBuff = StringFunctions.replace(outBuff, "$barcodeimage", barcodeimage);
      outBuff = StringFunctions.replace(outBuff, "$strRcopia", strRcopia);
      outBuff = StringFunctions.replace(outBuff, "$signBox", strSigBox);
      // Added by Channpreet for Task OR31-004 starts
      outBuff =
          StringFunctions.replace(outBuff, "$provider_agent_names", providerAgentsName.toString());
      outBuff = StringFunctions.replace(outBuff, "$logonUser", currentUser.toString());
      outBuff = StringFunctions.replace(outBuff, "$practiceUsername", practice_username);
      // Added by Channpreet for Task OR31-004 ends

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
    }
    return outBuff;
  }